diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-10-04 14:30:35 +0200 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-10-06 11:20:07 +0200 |
commit | db472075a4fb82bf6a491848941a5b9c92526c39 (patch) | |
tree | cd09477d48f52b2acdb7c0e460cb2aac07d4be00 /Macros.h | |
parent | ad3acfc847e9d54f07a0684c19181d5f4c28fee4 (diff) |
Enable -Wcast-qual compiler warning
Diffstat (limited to 'Macros.h')
-rw-r--r-- | Macros.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -33,4 +33,20 @@ #endif /* __GNUC__ */ +// ignore casts discarding const specifier, e.g. +// const char [] -> char * / void * +// const char *[2]' -> char *const * +#ifdef __clang__ +#define IGNORE_WCASTQUAL_BEGIN _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#define IGNORE_WCASTQUAL_END _Pragma("clang diagnostic pop") +#elif defined(__GNUC__) +#define IGNORE_WCASTQUAL_BEGIN _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#define IGNORE_WCASTQUAL_END _Pragma("GCC diagnostic pop") +#else +#define IGNORE_WCASTQUAL_BEGIN +#define IGNORE_WCASTQUAL_END +#endif + #endif |