]> git.ozlabs.org Git - ccan/blobdiff - ccan/typesafe_cb/test/compile_fail-typesafe_cb.c
endian: add constant versions.
[ccan] / ccan / typesafe_cb / test / compile_fail-typesafe_cb.c
index d305d5fb1101fc1c3a242346f97a5218fd166744..81e36d7b87b901fb4922e5e3174ef466b242ec9a 100644 (file)
@@ -1,4 +1,4 @@
-#include "typesafe_cb/typesafe_cb.h"
+#include <ccan/typesafe_cb/typesafe_cb.h>
 #include <stdlib.h>
 
 static void _register_callback(void (*cb)(void *arg), void *arg)
@@ -6,7 +6,7 @@ static void _register_callback(void (*cb)(void *arg), void *arg)
 }
 
 #define register_callback(cb, arg)                             \
-       _register_callback(typesafe_cb(void, (cb), (arg)), (arg))
+       _register_callback(typesafe_cb(void, void *, (cb), (arg)), (arg))
 
 static void my_callback(char *p)
 {
@@ -14,10 +14,11 @@ static void my_callback(char *p)
 
 int main(int argc, char *argv[])
 {
+       char str[] = "hello world";
 #ifdef FAIL
        int *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."
+#error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
 #endif
 #else
        char *p;
@@ -25,7 +26,7 @@ int main(int argc, char *argv[])
        p = NULL;
 
        /* This should work always. */
-       register_callback(my_callback, "hello world");
+       register_callback(my_callback, str);
 
        /* This will fail with FAIL defined */
        register_callback(my_callback, p);