s3-libgpo/gpo_filesync.c: return on read error
[Samba/gebeck_regimport.git] / lib / ccan / typesafe_cb / test / compile_fail-typesafe_cb.c
blob81e36d7b87b901fb4922e5e3174ef466b242ec9a
1 #include <ccan/typesafe_cb/typesafe_cb.h>
2 #include <stdlib.h>
4 static void _register_callback(void (*cb)(void *arg), void *arg)
8 #define register_callback(cb, arg) \
9 _register_callback(typesafe_cb(void, void *, (cb), (arg)), (arg))
11 static void my_callback(char *p)
15 int main(int argc, char *argv[])
17 char str[] = "hello world";
18 #ifdef FAIL
19 int *p;
20 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
21 #error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
22 #endif
23 #else
24 char *p;
25 #endif
26 p = NULL;
28 /* This should work always. */
29 register_callback(my_callback, str);
31 /* This will fail with FAIL defined */
32 register_callback(my_callback, p);
33 return 0;