<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Aug 17, 2014 at 9:43 AM, Edward Diener <span dir="ltr"><<a href="mailto:eldlistmailingz@tropicsoft.com" target="_blank">eldlistmailingz@tropicsoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On 8/17/2014 12:22 PM, Richard Smith wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Can you provide a reduced test case for this?<br>
</blockquote>
<br></div>
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.<div class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
What is on the line A:V?<br>
</blockquote>
<br></div>
BOOST_MPL_AUX_NA_SPEC(3, if_)<br>
<br>
There is no empty macro argument here. But much further down in the macro stack trace which clang output shows at B:W is:<br>
<br>
#define BOOST_PP_VARIADIC_ELEM(n, ...) BOOST_PP_CAT(BOOST_PP_<u></u>VARIADIC_ELEM_, n)(__VA_ARGS__,)<br>
<br>
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.</blockquote>
<div><br></div><div>OK, I see. We use the diagnostic state at the expansion location (that is, where the outermost macro expansion occurs, or more generally, the point in the *preprocessed* token stream where the issue occurs) to determine whether to enable the diagnostic, and there are some good reasons why we pick that point to perform the check. We could change that for this particular diagnostic, but the simplest approach would seem to be to make Boost disable the diagnostic at the right place in the token stream:</div>
<div><br></div><div>#if defined(__clang__)<br></div><div>#define BOOST_SUPPRESS_EMPTY_MACRO_ARG_PUSH() _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wc99-extensions\"")<br>
</div><div>#define BOOST_SUPPRESS_EMPTY_MACRO_ARG_POP() _Pragma("clang diagnostic pop")</div><div>#else</div><div>// ...</div><div>#endif</div><div><br></div><div>#define BOOST_PP_VARIADIC_ELEM(n, ...) \</div><div>
  BOOST_SUPPRESS_EMPTY_MACRO_ARG_PUSH() \</div><div>  BOOST_PP_CAT(BOOST_PP_<u></u>VARIADIC_ELEM_, n)(__VA_ARGS__,) \<br></div><div>  BOOST_SUPPRESS_EMPTY_MACRO_ARG_POP()</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
On 17 Aug 2014 07:39, "Edward Diener" <<a href="mailto:eldlistmailingz@tropicsoft.com" target="_blank">eldlistmailingz@tropicsoft.<u></u>com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:eldlistmailingz@tropicsoft.com" target="_blank">eldlistmailingz@<u></u>tropicsoft.com</a>>> wrote:<br>
<br>
    Compiling some code I am receiving the warning:<br>
<br>
    "warning: empty macro arguments are a C99 feature [-Wc99-extensions]"<br>
<br>
    The warning is output for file A, line V during a macro invocation.<br>
<br>
    But the actual macro using an empty argument is in file B, line W.<br>
    If I surround file B, line W with:<br>
<br>
    # pragma clang diagnostic push<br>
    # pragma clang diagnostic ignored "-Wc99-extensions"<br>
<br>
    // line W, macro definition with empty macro argument<br>
<br>
    # pragma clang diagnostic pop<br>
<br>
    the warning still occurs. Is this a clang bug ?<br>
<br>
    I have noticed that if I get a warning about using variadic macros (<br>
    "-Wvariadic-macros" ) if I surround the actual variadic macro with:<br>
<br>
    # pragma clang diagnostic push<br>
    # pragma clang diagnostic ignored "-Wvariadic-macros"<br>
<br>
    // variadic macro definition<br>
<br>
    # pragma clang diagnostic pop<br>
<br>
    the warning goes away.<br>
<br>
    For various reasons too lengthy to explain, std=c99 or std=c++0x or<br>
    std=c++11 are not specified but I still need to eliminate the<br>
    "-Wc99-extensions" warning in the actual source file.<br>
</div></div></blockquote><div class=""><div class="h5">
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div></div>