diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2014-12-02 11:06:09 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2014-12-02 11:06:09 +0000 |
commit | d04e6fdd403fcd39dc96075df858cd942c3ceab5 (patch) | |
tree | bfb6268d3c7431aa8d44500ae098d0ca4847e304 /include/clang/Basic/DiagnosticLexKinds.td | |
parent | 85fd1028d5358138fcfae7adb9c09a386a91c332 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/DiagnosticLexKinds.td')
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 2fcfa02c39..5eb9e65953 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -290,6 +290,14 @@ def note_pp_ambiguous_macro_chosen : Note< "expanding this definition of %0">; def note_pp_ambiguous_macro_other : Note< "other definition of %0">; +def warn_pp_macro_hides_keyword : Warning< + "keyword or reserved identifier is hidden by macro definition">, + InGroup<KeywordAsMacro>; +def warn_pp_macro_is_reserved_id : Warning< + "macro name is a keyword or reserved identifier">, InGroup<KeywordAsMacro>; +def warn_pp_defundef_reserved_ident : Warning< + "reserved identifier is used as macro name">, DefaultIgnore, + InGroup<ReservedIdAsMacro>; def pp_invalid_string_literal : Warning< "invalid string literal, ignoring final '\\'">; |