Emit warning if define or undef reserved identifier or keyword.
authorSerge Pavlov <sepavloff@gmail.com>
Tue, 2 Dec 2014 11:06:09 +0000 (11:06 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Tue, 2 Dec 2014 11:06:09 +0000 (11:06 +0000)
commit1ecb41c09b7d81b6ad0d9934ede8464a5c142b2c
tree83e7f2a8ab343d7570fbf20054402eb00643e8fa
parenta0199b9a594151cd8889665de57ab2b3f69ee137
Emit warning if define or undef reserved identifier or keyword.

Summary:
This change implements warnings if macro name is identical to a keyword or
reserved identifier. The warnings are different depending on the "danger"
of the operation. Defining macro that replaces a keyword is on by default.
Other cases produce warning that is off by default but can be turned on
using option -Wreserved-id-macro.

This change fixes PR11488.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

Differential Revision: http://reviews.llvm.org/D6194

llvm-svn: 223114
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/IdentifierTable.h
clang/lib/Basic/IdentifierTable.cpp
clang/lib/Lex/PPDirectives.cpp
clang/test/PCH/single-token-macro.c
clang/test/Preprocessor/cxx_oper_keyword_ms_compat.cpp
clang/test/Sema/thread-specifier.c