[cfe-dev] Ignoring "-Wc99-extensions" diagnostic warning

Edward Diener eldlistmailingz at tropicsoft.com
Sun Aug 17 07:37:30 PDT 2014


Compiling some code I am receiving the warning:

"warning: empty macro arguments are a C99 feature [-Wc99-extensions]"

The warning is output for file A, line V during a macro invocation.

But the actual macro using an empty argument is in file B, line W. If I 
surround file B, line W with:

# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wc99-extensions"

// line W, macro definition with empty macro argument

# pragma clang diagnostic pop

the warning still occurs. Is this a clang bug ?

I have noticed that if I get a warning about using variadic macros ( 
"-Wvariadic-macros" ) if I surround the actual variadic macro with:

# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wvariadic-macros"

// variadic macro definition

# pragma clang diagnostic pop

the warning goes away.

For various reasons too lengthy to explain, std=c99 or std=c++0x or 
std=c++11 are not specified but I still need to eliminate the 
"-Wc99-extensions" warning in the actual source file.




More information about the cfe-dev mailing list