r224012 - Emit warning if define or undef reserved identifier or keyword.

Aaron Ballman aaron at aaronballman.com
Mon Dec 15 10:33:12 PST 2014


On Mon, Dec 15, 2014 at 1:28 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Mon, Dec 15, 2014 at 1:24 PM, Nico Weber <thakis at chromium.org> wrote:
>> I agree that off by default warnings are a "warning smell". But this doesn't
>> look like a warning that's supposed to find bugs, it's more a language
>> compliance thing, like -pedantic. Maybe it should be an ExtWarn. But is
>> someone is actively implementing the suggested heuristics, we can wait and
>> see how they do first, I suppose.
>
> I could agree that it should perhaps be treated under -pedantic, but
> have no strong feelings.
>
>> For the "final(a,b,c)" define: should we warn on that? It doesn't change the
>> meaning of the keyword "final" since that doesn't have parameters.
>
> Doesn't have parameters *today* -- it's still a reserved keyword for
> the language.

Btw, just to point it out [macro.names]p2:

A translation unit shall not #define or #undef names lexically
identical to keywords, to the identifiers listed in Table 3, or to the
attribute-tokens described in 7.6.

~Aaron



More information about the cfe-commits mailing list