changeset 1717:2f2c7ae058d7 draft

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.
author Rob Landley <rob@landley.net>
date Sun, 01 Mar 2015 16:35:05 -0600
parents ef5d02d0d37f
children 3ac823675413
files lib/portability.h
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/portability.h	Sun Mar 01 16:16:50 2015 -0600
+++ b/lib/portability.h	Sun Mar 01 16:35:05 2015 -0600
@@ -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