diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-30 18:55:52 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-30 18:55:52 +0000 |
commit | 8d3f6133da9abb58cf05d55f7b8d86dd00257832 (patch) | |
tree | 1bb89db20535aa0caf2a9c6ff5bba422b0b66648 /lib/Lex/PPMacroExpansion.cpp | |
parent | baa7ca1142990e1ad6d4e9d2c73adb749ff50789 (diff) |
[preprocessor] Don't warn about "disabled expansion of recursive macro"
for "#define X X".
This is a pattern that, for example, stdbool.h uses.
rdar://12435773
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPMacroExpansion.cpp')
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 6379144885..939c4faf7a 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -459,7 +459,10 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, if (MacroInfo *NewMI = getMacroInfo(NewII)) if (!NewMI->isEnabled() || NewMI == MI) { Identifier.setFlag(Token::DisableExpand); - Diag(Identifier, diag::pp_disabled_macro_expansion); + // Don't warn for "#define X X" like "#define bool bool" from + // stdbool.h. + if (NewMI != MI) + Diag(Identifier, diag::pp_disabled_macro_expansion); } } |