13 called_function (void *ptr
);
20 create_code (gcc_jit_context
*ctxt
, void *user_data
)
22 /* Verify that we get an error (rather than a crash)
23 if the client code reuses a gcc_jit_param * for
24 two different functions. */
25 gcc_jit_type
*void_type
=
26 gcc_jit_context_get_type (ctxt
, GCC_JIT_TYPE_VOID
);
27 gcc_jit_type
*int_type
=
28 gcc_jit_context_get_type (ctxt
, GCC_JIT_TYPE_INT
);
31 gcc_jit_param
*param
=
32 gcc_jit_context_new_param (ctxt
, NULL
, int_type
, "i");
34 /* Try to use it for two different functions. */
35 gcc_jit_context_new_function (ctxt
, NULL
,
36 GCC_JIT_FUNCTION_EXPORTED
,
41 gcc_jit_context_new_function (ctxt
, NULL
,
42 GCC_JIT_FUNCTION_EXPORTED
,
50 verify_code (gcc_jit_context
*ctxt
, gcc_jit_result
*result
)
52 CHECK_VALUE (result
, NULL
);
54 /* Verify that the correct error message was emitted. */
55 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt
),
56 ("gcc_jit_context_new_function:"
57 " parameter 0 \"i\" (type: int)"
58 " for function fn_two"
59 " was already used for function fn_one"))