summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-18 19:50:15 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-18 19:50:15 +0000
commitb495cc1a7ba585f869d4f5cfc248047c213df1be (patch)
tree71f355c1eba190e4b43f80aab53c5000dc00819e /clang/lib/Lex
parentb02a9dfa55cc617a5dc2c05fcee1601c57ba4c95 (diff)
downloadbcm5719-llvm-b495cc1a7ba585f869d4f5cfc248047c213df1be.tar.gz
bcm5719-llvm-b495cc1a7ba585f869d4f5cfc248047c213df1be.zip
When redefining a macro don't warn twice if it's not used and don't warn for duplicate
definition by command line options. Fixes rdar://8875916. llvm-svn: 123767
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index f422d254f0f..0f0d25b887a 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -1527,7 +1527,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) {
// then don't bother calling MacroInfo::isIdenticalTo.
if (!getDiagnostics().getSuppressSystemWarnings() ||
!SourceMgr.isInSystemHeader(DefineTok.getLocation())) {
- if (!OtherMI->isUsed())
+ if (!OtherMI->isUsed() && OtherMI->isWarnIfUnused())
Diag(OtherMI->getDefinitionLoc(), diag::pp_macro_not_used);
// Macros must be identical. This means all tokens and whitespace
@@ -1539,6 +1539,8 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) {
Diag(OtherMI->getDefinitionLoc(), diag::note_previous_definition);
}
}
+ if (OtherMI->isWarnIfUnused())
+ WarnUnusedMacroLocs.erase(OtherMI->getDefinitionLoc());
ReleaseMacroInfo(OtherMI);
}
OpenPOWER on IntegriCloud