]> git.ozlabs.org Git - ccan/blobdiff - ccan/typesafe_cb/test/compile_fail-typesafe_cb.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / typesafe_cb / test / compile_fail-typesafe_cb.c
index bd20131368cf35dd2bc636d9f0d2bf44f3bd0557..5717f97be64cc0d5676f06f5dc2930b7d7a518ac 100644 (file)
@@ -3,21 +3,25 @@
 
 static void _register_callback(void (*cb)(void *arg), void *arg)
 {
+       (void)cb;
+       (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)
 {
+       (void)p;
 }
 
-int main(int argc, char *argv[])
+int main(void)
 {
+       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 +29,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);