aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Basic/Diagnostic.cpp4
-rw-r--r--lib/Sema/SemaDecl.cpp12
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index f9e1d2bda3..0f8f314f15 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -113,6 +113,7 @@ Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
WarningsAsErrors = false;
WarnOnExtensions = false;
ErrorOnExtensions = false;
+ SuppressSystemWarnings = false;
// Clear all mappings, setting them to MAP_DEFAULT.
memset(DiagMappings, 0, sizeof(DiagMappings));
@@ -224,7 +225,8 @@ void Diagnostic::Report(DiagnosticClient* C,
// have to check on the original DiagID here, because we also want to
// ignore extensions and warnings in -Werror and -pedantic-errors modes,
// which *map* warnings/extensions to errors.
- if (DiagID < diag::NUM_BUILTIN_DIAGNOSTICS &&
+ if (SuppressSystemWarnings &&
+ DiagID < diag::NUM_BUILTIN_DIAGNOSTICS &&
getBuiltinDiagClass(DiagID) != ERROR &&
Loc.isValid() && Loc.isFileID() && Loc.isInSystemHeader())
return;
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 726372356e..2f4350766a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -276,11 +276,13 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
// *either* declaration is in a system header. The code below implements
// this adhoc compatibility rule. FIXME: The following code will not
// work properly when compiling ".i" files (containing preprocessed output).
- SourceManager &SrcMgr = Context.getSourceManager();
- if (SrcMgr.isInSystemHeader(Old->getLocation()))
- return New;
- if (SrcMgr.isInSystemHeader(New->getLocation()))
- return New;
+ if (PP.getDiagnostics().getSuppressSystemWarnings()) {
+ SourceManager &SrcMgr = Context.getSourceManager();
+ if (SrcMgr.isInSystemHeader(Old->getLocation()))
+ return New;
+ if (SrcMgr.isInSystemHeader(New->getLocation()))
+ return New;
+ }
Diag(New->getLocation(), diag::err_redefinition, New->getName());
Diag(Old->getLocation(), diag::err_previous_definition);