[cfe-commits] r55639 - in /cfe/trunk: lib/Lex/Preprocessor.cpp test/Preprocessor/extension-warning.c
steve naroff
snaroff at apple.com
Wed Sep 3 02:37:30 PDT 2008
I like your solution (to not warn for underscore keywords).
If this type of check is ever needed, it can be implemented outside
the core lexer/preprocessor.
snaroff
On Sep 2, 2008, at 8:34 PM, Eli Friedman wrote:
> On Tue, Sep 2, 2008 at 11:50 AM, Steve Naroff <snaroff at apple.com>
> wrote:
>> - Replace FIXME in Preprocessor::HandleIdentifier() with a check
>> that avoids diagnosing extension tokens that originate from macro
>> definitions.
>>
>> + // We avoid diagnosing tokens that originate from macro
>> definitions.
>> + if (II.isExtensionToken() && Features.C99 && !
>> DisableMacroExpansion)
>> Diag(Identifier, diag::ext_token_used);
>
> I think the right solution here is just to not warn for reserved
> keywords (those starting with two underscores or an underscore plus a
> capital letter). Allowing such keywords without a warning doesn't
> affect standards-compliance (C99 7.1.3p2, and similar passages in all
> the other C/C++ standards). The only reason I can imagine why anyone
> would care to see warnings about them would be some sort of
> portability checker, which isn't normal usage, and probably doesn't
> belong in the main compiler.
>
> If we do that, whether the identifier comes out of a macro doesn't
> matter; system headers can't use plain versions of extension keywords
> anyway because they would break in any mode which didn't include them.
>
> -Eli
More information about the cfe-commits
mailing list