Mark unused arguments in many modules.
[ccan] / ccan / typesafe_cb / test / compile_fail-typesafe_cb.c
1 #include <ccan/typesafe_cb/typesafe_cb.h>
2 #include <stdlib.h>
3
4 static void _register_callback(void (*cb)(void *arg), void *arg)
5 {
6         (void)cb;
7         (void)arg;
8 }
9
10 #define register_callback(cb, arg)                              \
11         _register_callback(typesafe_cb(void, void *, (cb), (arg)), (arg))
12
13 static void my_callback(char *p)
14 {
15         (void)p;
16 }
17
18 int main(void)
19 {
20         char str[] = "hello world";
21 #ifdef FAIL
22         int *p;
23 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
24 #error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
25 #endif
26 #else
27         char *p;
28 #endif
29         p = NULL;
30
31         /* This should work always. */
32         register_callback(my_callback, str);
33
34         /* This will fail with FAIL defined */
35         register_callback(my_callback, p);
36         return 0;
37 }