compile_fail-printf.c 361 B

12345678910111213141516171819202122
  1. #include <ccan/compiler/compiler.h>
  2. static void PRINTF_FMT(2,3) my_printf(int x, const char *fmt, ...)
  3. {
  4. }
  5. int main(int argc, char *argv[])
  6. {
  7. unsigned int i = 0;
  8. my_printf(1, "Not a pointer "
  9. #ifdef FAIL
  10. "%p",
  11. #if !HAVE_ATTRIBUTE_PRINTF
  12. #error "Unfortunately we don't fail if !HAVE_ATTRIBUTE_PRINTF."
  13. #endif
  14. #else
  15. "%i",
  16. #endif
  17. i);
  18. return 0;
  19. }