9 create_code (gcc_jit_context
*ctxt
, void *user_data
)
11 gcc_jit_type
*int_type
=
12 gcc_jit_context_get_type (ctxt
, GCC_JIT_TYPE_INT
);
14 /* Trigger an API error by passing bad data. */
15 (void)gcc_jit_context_new_function (
19 /* Non-valid enum value: */
20 (enum gcc_jit_function_kind
)42,
22 int_type
, /* gcc_jit_type *return_type, */
23 "foo", /* const char *name, */
24 0, /* int num_params, */
25 NULL
, /* gcc_jit_param **params, */
26 0); /* int is_variadic */
30 verify_code (gcc_jit_context
*ctxt
, gcc_jit_result
*result
)
32 /* Ensure that the bad API usage prevents the API giving a bogus
34 CHECK_VALUE (result
, NULL
);
36 /* Verify that the correct error message was emitted. */
37 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt
),
38 ("gcc_jit_context_new_function:"
39 " unrecognized value for enum gcc_jit_function_kind: 42"));