X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;ds=sidebyside;f=ccan%2Fcontainer_of%2Ftest%2Fcompile_fail-var-types.c;h=ecdd90916fa64a49ddd899b67f3c5b222186d9a8;hb=8967bc9e1bdd68f2dc33e9d80bbf0f944fb7e772;hp=f9312b69b3a0486f0b07506781638c3e09cfce89;hpb=39357f4e89f4ac02eb11861812cbfc67b4f1d4ef;p=ccan diff --git a/ccan/container_of/test/compile_fail-var-types.c b/ccan/container_of/test/compile_fail-var-types.c index f9312b69..ecdd9091 100644 --- a/ccan/container_of/test/compile_fail-var-types.c +++ b/ccan/container_of/test/compile_fail-var-types.c @@ -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; }