OpenMP/C++: Use STRIP_REFERENCE_REF to fix declare variant with reference-returning...
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-missing-return.c
blob5e2434671a1a15d690581e9f8753b65201fb5dd6
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 /* Let's try to inject the equivalent of:
12 int
13 test_fn ()
16 and verify that the API complains about the lack of
17 a returned value.
19 gcc_jit_type *int_type =
20 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
22 (void)gcc_jit_context_new_function (ctxt, NULL,
23 GCC_JIT_FUNCTION_EXPORTED,
24 int_type,
25 "test_fn",
26 0, NULL,
27 0);
30 void
31 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
33 CHECK_VALUE (result, NULL);
35 /* Verify that the correct error message was emitted. */
36 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
37 "function test_fn returns non-void (type: int)"
38 " but has no blocks");