Be less ugly when hiding warnings for using the %B formatter
- Take advantage of the new _Pragma operator to hide the printf warning suppression inside of macros instead of needing to litter the code around Printfs with a bunch of junk.
This commit is contained in:
parent
bce7d12379
commit
f76d137d33
3 changed files with 22 additions and 15 deletions
|
|
@ -47,6 +47,24 @@
|
|||
#define PRINTFISH(x)
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#define IGNORE_FORMAT_PRE \
|
||||
_Pragma("GCC diagnostic push" \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-invalid-specifier\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
|
||||
#define IGNORE_FORMAT_POST _Pragma("GCC diagnostic pop")
|
||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)))
|
||||
#define IGNORE_FORMAT_PRE \
|
||||
_Pragma("GCC diagnostic push" \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat=\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
|
||||
#define IGNORE_FORMAT_POST _Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
#define IGNORE_FORMAT_PRE
|
||||
#define IGNORE_FORMAT_POST
|
||||
#endif
|
||||
|
||||
|
||||
struct FStringData
|
||||
{
|
||||
unsigned int Len; // Length of string, excluding terminating null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue