From d7d40b7aeea57842c830c8ad618d8f7ad89ed8ba Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 18 Dec 2014 11:14:21 +0000 Subject: Fixed warnings on redefine keywords and reserved ids. Repared support for warnings -Wkeyword-macro and -Wreserved-id-macro. The warning -Wkeyword-macro now is not issued in patterns that are used in configuration scripts: #define inline also for 'const', 'extern' and 'static'. If macro repalcement is identical to macro name, the warning also is not issued: #define volatile volatile And finally if macro replacement is also a keyword identical to the replaced one but decorated with leading/trailing underscores: #define inline __inline #define inline __inline__ #define inline _inline // in MSVC compatibility mode Warning -Wreserved-id-macro is off by default, it could help catching things like: #undef __cplusplus git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224512 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticLexKinds.td | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/clang/Basic/DiagnosticLexKinds.td') diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 65f9f77af4..b9461c1a83 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -292,6 +292,9 @@ def note_pp_ambiguous_macro_other : Note< "other definition of %0">; def warn_pp_macro_hides_keyword : Extension< "keyword is hidden by macro definition">, InGroup; +def warn_pp_macro_is_reserved_id : Warning< + "macro name is a reserved identifier">, DefaultIgnore, + InGroup; def pp_invalid_string_literal : Warning< "invalid string literal, ignoring final '\\'">; -- cgit v1.2.3