X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=typesafe_cb%2Ftest%2Fcompile_fail-typesafe_cb_postargs.c;fp=typesafe_cb%2Ftest%2Fcompile_fail-typesafe_cb_postargs.c;h=e6ec82606cef107bcb79b62cfa464257c7cfd811;hp=0000000000000000000000000000000000000000;hb=eded23d444462d115adf0a96b36b7b86a118f7b4;hpb=9927eebe7c5c257c990d86baaa8760994195d48b diff --git a/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c b/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c new file mode 100644 index 00000000..e6ec8260 --- /dev/null +++ b/typesafe_cb/test/compile_fail-typesafe_cb_postargs.c @@ -0,0 +1,24 @@ +#include "typesafe_cb/typesafe_cb.h" +#include + +static void _register_callback(void (*cb)(void *arg, int x), void *arg) +{ +} +#define register_callback(cb, arg) \ + _register_callback(typesafe_cb_postargs(void, (cb), (arg), int), (arg)) + +static void my_callback(char *p, int x) +{ +} + +int main(int argc, char *argv[]) +{ +#ifdef FAIL + int *p; +#else + char *p; +#endif + p = NULL; + register_callback(my_callback, p); + return 0; +}