Typesafe callback infrastructure.
[ccan] / typesafe_cb / test / compile_fail-typesafe_cb_preargs.c
1 #include "typesafe_cb/typesafe_cb.h"
2 #include <stdlib.h>
3
4 static void _register_callback(void (*cb)(int x, void *arg), void *arg)
5 {
6 }
7
8 #define register_callback(cb, arg)                              \
9         _register_callback(typesafe_cb_preargs(void, (cb), (arg), int), (arg))
10
11 static void my_callback(int x, char *p)
12 {
13 }
14
15 int main(int argc, char *argv[])
16 {
17 #ifdef FAIL
18         int *p;
19 #else
20         char *p;
21 #endif
22         p = NULL;
23         register_callback(my_callback, p);
24         return 0;
25 }