From 1be99e695059ba7dbe44765f4b477f7e173e98d1 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sun, 1 Mar 2015 16:16:50 -0600 Subject: let the compiler check format strings i'll be AFK for a week, so here's the patch i've been using this evening to find other format string mistakes. BSD uses __printflike and takes two arguments instead of hard-coding (1,2), but i figured that as long as you don't need the generality you'd prefer not to have it. and it's easy enough to retrofit if we ever do have a formatting function that takes other arguments. --- lib/portability.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/portability.h') diff --git a/lib/portability.h b/lib/portability.h index 70e33bf6..809f376c 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -11,8 +11,10 @@ #ifdef __GNUC__ #define noreturn __attribute__((noreturn)) +#define printf_format __attribute__((format(printf, 1, 2))) #else #define noreturn +#define printf_format #endif // Always use long file support. -- cgit v1.2.3