From eb4b1143b1f54a96002a83ea961d40d3169e1ae2 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 1 Mar 2015 16:35:05 -0600 Subject: 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. --- lib/portability.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/portability.h') diff --git a/lib/portability.h b/lib/portability.h index 809f376c..a10213e5 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 -- cgit v1.2.3