3 Test that the proper error is triggered when we build a register variable
4 with a register name that doesn't exist.
11 #include "libgccjit.h"
15 create_code (gcc_jit_context
*ctxt
, void *user_data
)
17 gcc_jit_type
*int_type
=
18 gcc_jit_context_get_type (ctxt
, GCC_JIT_TYPE_INT
);
19 gcc_jit_type
*array_type
=
20 gcc_jit_context_new_array_type (ctxt
, NULL
, int_type
, 4096);
21 gcc_jit_lvalue
*global_variable
=
22 gcc_jit_context_new_global (
23 ctxt
, NULL
, GCC_JIT_GLOBAL_EXPORTED
, array_type
, "global_variable");
24 gcc_jit_lvalue_set_register_name(global_variable
, "r12");
28 verify_code (gcc_jit_context
*ctxt
, gcc_jit_result
*result
)
30 /* Ensure that the bad API usage prevents the API giving a bogus
32 CHECK_VALUE (result
, NULL
);
34 /* Verify that the correct error message was emitted. */
36 (gcc_jit_context_get_last_error (ctxt
),
37 "data type of 'global_variable' isn't suitable for a register");