Daily bump.
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-new-unary-op-bad-op.c
blobfaab139c68593a12421161a12a8171cda2939ea7
1 #include <stdlib.h>
2 #include <stdio.h>
4 #include "libgccjit.h"
6 #include "harness.h"
8 void
9 create_code (gcc_jit_context *ctxt, void *user_data)
11 /* Trigger an API error by passing bad data. */
12 (void)gcc_jit_context_new_unary_op (
13 ctxt,
14 NULL,
16 /* Non-valid enum value: */
17 (enum gcc_jit_unary_op) 42,
19 /* These aren't valid either: */
20 NULL, /* gcc_jit_type *result_type, */
21 NULL); /* gcc_jit_rvalue *rvalue */
24 void
25 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
27 /* Ensure that the bad API usage prevents the API giving a bogus
28 result back. */
29 CHECK_VALUE (result, NULL);
31 /* Verify that the correct error message was emitted. */
32 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
33 ("gcc_jit_context_new_unary_op:"
34 " unrecognized value for enum gcc_jit_unary_op: 42"));