X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftypesafe_cb%2Ftest%2Fcompile_fail-typesafe_cb_exact.c;fp=ccan%2Ftypesafe_cb%2Ftest%2Fcompile_fail-typesafe_cb_exact.c;h=0000000000000000000000000000000000000000;hb=b0fa019adb998c20a8740f5696b61ae87d2a77a6;hp=0f61d5decd5d3a45302c617377e56afbf18fef0b;hpb=076877c266706ba432987195422a1e8653bd0c3b;p=ccan diff --git a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_exact.c b/ccan/typesafe_cb/test/compile_fail-typesafe_cb_exact.c deleted file mode 100644 index 0f61d5de..00000000 --- a/ccan/typesafe_cb/test/compile_fail-typesafe_cb_exact.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -static void _register_callback(void (*cb)(void *arg), const void *arg) -{ -} - -#define register_callback(cb, arg) \ - _register_callback(typesafe_cb_exact(void, (cb), (arg)), (arg)) - -static void my_callback(const char *p) -{ -} - -int main(int argc, char *argv[]) -{ -#ifdef FAIL - char *p; -#if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P -#error "Unfortunately we don't fail if cast_if_type is a noop." -#endif -#else - const char *p; -#endif - p = NULL; - - /* This should work always. */ - register_callback(my_callback, (const char *)"hello world"); - - /* This will fail with FAIL defined */ - register_callback(my_callback, p); - return 0; -}