summaryrefslogtreecommitdiff
path: root/lib/portability.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-01 16:35:05 -0600
committerRob Landley <rob@landley.net>2015-03-01 16:35:05 -0600
commiteb4b1143b1f54a96002a83ea961d40d3169e1ae2 (patch)
tree27992d2fd018b7577fd82e985dc4904e5a1271c3 /lib/portability.h
parent1be99e695059ba7dbe44765f4b477f7e173e98d1 (diff)
downloadtoybox-eb4b1143b1f54a96002a83ea961d40d3169e1ae2.tar.gz
toybox-eb4b1143b1f54a96002a83ea961d40d3169e1ae2.tar.bz2
toybox-eb4b1143b1f54a96002a83ea961d40d3169e1ae2.zip
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.
Diffstat (limited to 'lib/portability.h')
-rw-r--r--lib/portability.h4
1 files changed, 4 insertions, 0 deletions
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