From: Rob Landley Date: Sun, 1 Mar 2015 22:35:05 +0000 (-0600) Subject: Only switch on printf format warnings for error_exit() and friends when TOYBOX_DEBUG... X-Git-Tag: upstream/0.6.0~187 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb4b1143b1f54a96002a83ea961d40d3169e1ae2;p=platform%2Fupstream%2Ftoybox.git Only switch on printf format warnings for error_exit() and friends when TOYBOX_DEBUG enabled. One again gcc manages to be incompetent about producing warnings. For example, in bzcat we error_exit() with a message that's an error code fed into an array of string constants, and apparently dereferencing an array of string literals doesn't give you a string literal according to -Wformat-security. Not breaking the code to humor the compiler here, the compiler is wrong. --- diff --git a/lib/portability.h b/lib/portability.h index 809f376..a10213e 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -11,8 +11,12 @@ #ifdef __GNUC__ #define noreturn __attribute__((noreturn)) +#if CFG_TOYBOX_DEBUG #define printf_format __attribute__((format(printf, 1, 2))) #else +#define printf_format +#endif +#else #define noreturn #define printf_format #endif