Mercurial > hg > toybox
comparison lib/portability.h @ 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 |
comparison
equal
deleted
inserted
replaced
1716:ef5d02d0d37f | 1717:2f2c7ae058d7 |
---|---|
9 | 9 |
10 // Test for gcc (using compiler builtin #define) | 10 // Test for gcc (using compiler builtin #define) |
11 | 11 |
12 #ifdef __GNUC__ | 12 #ifdef __GNUC__ |
13 #define noreturn __attribute__((noreturn)) | 13 #define noreturn __attribute__((noreturn)) |
14 #if CFG_TOYBOX_DEBUG | |
14 #define printf_format __attribute__((format(printf, 1, 2))) | 15 #define printf_format __attribute__((format(printf, 1, 2))) |
16 #else | |
17 #define printf_format | |
18 #endif | |
15 #else | 19 #else |
16 #define noreturn | 20 #define noreturn |
17 #define printf_format | 21 #define printf_format |
18 #endif | 22 #endif |
19 | 23 |