[cfe-commits] r55639 - in /cfe/trunk: lib/Lex/Preprocessor.cpp test/Preprocessor/extension-warning.c

Eli Friedman eli.friedman at gmail.com
Tue Sep 2 17:34:27 PDT 2008

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.


More information about the cfe-commits mailing list