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

Edward Diener eldlistmailingz at tropicsoft.com
Sun Aug 17 09:43:36 PDT 2014


On 8/17/2014 12:22 PM, Richard Smith wrote:
> Can you provide a reduced test case for this?

Very difficult with the actual situation since this is Boost, which 
tends to get complicated quickly. I will try to produce a manufactured 
situation which shows this problem, and then post it.

> What is on the line A:V?

BOOST_MPL_AUX_NA_SPEC(3, if_)

There is no empty macro argument here. But much further down in the 
macro stack trace which clang output shows at B:W is:

#define BOOST_PP_VARIADIC_ELEM(n, ...) 
BOOST_PP_CAT(BOOST_PP_VARIADIC_ELEM_, n)(__VA_ARGS__,)

with a little caret showing the empty argument. So when I surround that 
line at B:W with the appropriate #pragma it does not turn off the 
warning. No doubt if I surround A:V with the appropriate #pragma it may 
well turn off the warning, but that is a ridiculous way to solve the 
problem. Some other macro path may eventually invoke B:W and then the 
problem will re-occur etc. etc.

>
> On 17 Aug 2014 07:39, "Edward Diener" <eldlistmailingz at tropicsoft.com
> <mailto:eldlistmailingz at tropicsoft.com>> wrote:
>
>     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