I want to have a macro that's invoked like this:
GCC_WARNING(-Wuninitialized)
which expands to code like this:
_Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
I'm not having luck getting this to work, as the usual tricks of preprocessor joins and stringifying don't seem to apply or I don't know how to apply them here.
With the little help of preprocessor magic:
#define HELPER0(x) #x
#define HELPER1(x) HELPER0(GCC diagnostic ignored x)
#define HELPER2(y) HELPER1(#y)
#define GCC_WARNING(x) _Pragma(HELPER2(x))
GCC_WARNING(-Wuninitialized)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With