111
|
1 #include <stdlib.h>
|
|
2 #include <stdio.h>
|
|
3
|
|
4 #include "libgccjit.h"
|
|
5
|
|
6 #include "harness.h"
|
|
7
|
|
8 void
|
|
9 create_code (gcc_jit_context *ctxt, void *user_data)
|
|
10 {
|
|
11 gcc_jit_type *int_type =
|
|
12 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
|
|
13
|
|
14 /* Trigger an API error by passing a bad alignment. */
|
|
15 (void)gcc_jit_type_get_aligned (int_type, 7);
|
|
16 }
|
|
17
|
|
18 void
|
|
19 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
|
|
20 {
|
|
21 /* Ensure that the bad API usage prevents the API giving a bogus
|
|
22 result back. */
|
|
23 CHECK_VALUE (result, NULL);
|
|
24
|
|
25 /* Verify that the correct error message was emitted. */
|
|
26 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
|
|
27 ("gcc_jit_type_get_aligned:"
|
|
28 " alignment not a power of two: 7"));
|
|
29 }
|
|
30
|