X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fcompiler%2Ftest%2Fcompile_fail-printf.c;fp=ccan%2Fcompiler%2Ftest%2Fcompile_fail-printf.c;h=670126bba1b7ee7093e6ee925fe827073be1e533;hp=0000000000000000000000000000000000000000;hb=89f1301ed2b65cdb4730bb28c42428873a69faec;hpb=a8e0cfb1b02bd89850540f60232fc52fb0a11500 diff --git a/ccan/compiler/test/compile_fail-printf.c b/ccan/compiler/test/compile_fail-printf.c new file mode 100644 index 00000000..670126bb --- /dev/null +++ b/ccan/compiler/test/compile_fail-printf.c @@ -0,0 +1,22 @@ +#include + +static void PRINTF_ATTRIBUTE(2,3) my_printf(int x, const char *fmt, ...) +{ +} + +int main(int argc, char *argv[]) +{ + unsigned int i = 0; + + my_printf(1, "Not a pointer " +#ifdef FAIL + "%p", +#if !HAVE_ATTRIBUTE_PRINTF +#error "Unfortunately we don't fail if !HAVE_ATTRIBUTE_PRINTF." +#endif +#else + "%i", +#endif + i); + return 0; +}