3 ms·
-Wno-specific-warning (I think it's always had this, or at least for a very long time).
by tubs 10y ago
-Wno-specific-warning (I think it's always had this, or at least for a very long time).
- MaulingMonkey 10y agoAnd: #pragma GCC diagnostic push #pragma GCC diagnostic warning "-Wspecific-warning" #pragma GCC diagnostic ignored "-Wspecific-warning" ... #pragma GCC diagnostic pop For warnings you want to disable in a smaller scope. s/GCC/clang/ for clang. Bonus points: #define MM_WARNING_IGNORE_GCC(x) MM_IF_GCC( _Pragma(GCC diagnostic ignored x) ) #define MM_WARNING_IGNORE_CLANG(x) MM_IF_CLANG( _Pragma(clang diagnostic ignored x) ) #define MM_WARNING_IGNORE_MSVC(x) MM_IF_MSVC( __pragma(warning(disable: x)) ) #define MM_WARNING_PUSH() \ IF_GCC( _Pragma(GCC diagnostic push) ) \ IF_CLANG( _Pragma(clang diagnostic push) ) \ IF_MSVC( __pragma(warning(push)) ) #define MM_WARNING_POP() \ IF_GCC( _Pragma(GCC diagnostic pop) ) \ IF_CLANG( _Pragma(clang diagnostic pop) ) \ IF_MSVC( __pragma(warning(pop)) ) MM_WARNING_PUSH() MM_WARNING_IGNORE_GCC("-Wspecific-warning") MM_WARNING_IGNORE_CLANG("-Wspecific-warning") MM_WARNING_IGNORE_MSVC(1234) ... MM_WARNING_POP() Defining MM_IF_*() is left as an exercise to the reader.
- bla2 10y agoclang understands #pragma GCC diagnostic fine, no need to have special code for it.
- MaulingMonkey 10y agoHmm. I could swear this wasn't the case in one of the build environments I ran into (possibly an older version of clang or something? or perhaps I'm thinking of some other non-diagnostic pragma...)