]> git.ozlabs.org Git - ccan/blobdiff - ccan/container_of/test/compile_fail-var-types.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / container_of / test / compile_fail-var-types.c
index 5c7767985223b62259a7cea1c08c0dd8e60fc630..ecdd90916fa64a49ddd899b67f3c5b222186d9a8 100644 (file)
@@ -1,4 +1,4 @@
-#include "container_of/container_of.h"
+#include <ccan/container_of/container_of.h>
 #include <stdlib.h>
 
 struct foo {
@@ -6,7 +6,7 @@ struct foo {
        char b;
 };
 
-int main(int argc, char *argv[])
+int main(void)
 {
        struct foo foo = { .a = 1, .b = 2 }, *foop;
        int *intp = &foo.a;
@@ -14,8 +14,12 @@ int main(int argc, char *argv[])
 #ifdef FAIL
        /* b is a char, but intp is an int * */
        foop = container_of_var(intp, foop, b);
+#if !HAVE_TYPEOF
+#error "Unfortunately we don't fail if we don't have typeof."
+#endif
 #else
        foop = NULL;
 #endif
+       (void) foop; /* Suppress unused-but-set-variable warning. */
        return intp == NULL;
 }