diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 1 | ||||
-rw-r--r-- | lib/Basic/DiagnosticIDs.cpp | 27 | ||||
-rw-r--r-- | lib/Frontend/Warnings.cpp | 7 |
3 files changed, 28 insertions, 7 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index b82b062a72..0e4159db8d 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -43,6 +43,7 @@ Diagnostic::Diagnostic(const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags, AllExtensionsSilenced = 0; IgnoreAllWarnings = false; WarningsAsErrors = false; + EnableAllWarnings = false; ErrorsAsFatal = false; SuppressSystemWarnings = false; SuppressAllDiagnostics = false; diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index fa397c9ac9..ace92aceb4 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -496,14 +496,27 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, switch (MappingInfo & 7) { default: assert(0 && "Unknown mapping!"); case diag::MAP_IGNORE: - // Ignore this, unless this is an extension diagnostic and we're mapping - // them onto warnings or errors. - if (!isBuiltinExtensionDiag(DiagID) || // Not an extension - Diag.ExtBehavior == Diagnostic::Ext_Ignore || // Ext ignored - (MappingInfo & 8) != 0) // User explicitly mapped it. + if (Diag.EnableAllWarnings) { + // Leave the warning disabled if it was explicitly ignored. + if ((MappingInfo & 8) != 0) + return DiagnosticIDs::Ignored; + + Result = Diag.WarningsAsErrors ? DiagnosticIDs::Error + : DiagnosticIDs::Warning; + } + // Otherwise, ignore this diagnostic unless this is an extension diagnostic + // and we're mapping them onto warnings or errors. + else if (!isBuiltinExtensionDiag(DiagID) || // Not an extension + Diag.ExtBehavior == Diagnostic::Ext_Ignore || // Ext ignored + (MappingInfo & 8) != 0) { // User explicitly mapped it. return DiagnosticIDs::Ignored; - Result = DiagnosticIDs::Warning; - if (Diag.ExtBehavior == Diagnostic::Ext_Error) Result = DiagnosticIDs::Error; + } + else { + Result = DiagnosticIDs::Warning; + } + + if (Diag.ExtBehavior == Diagnostic::Ext_Error) + Result = DiagnosticIDs::Error; if (Result == DiagnosticIDs::Error && Diag.ErrorsAsFatal) Result = DiagnosticIDs::Fatal; break; diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp index 215f8f8b22..d24779e1a9 100644 --- a/lib/Frontend/Warnings.cpp +++ b/lib/Frontend/Warnings.cpp @@ -98,6 +98,13 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, Mapping = isPositive ? diag::MAP_ERROR : diag::MAP_WARNING_NO_WERROR; Opt = Specifier; } + + // -Weverything is a special case as well. It implicitly enables all + // warnings, including ones not explicitly in a warning group. + if (Opt == "everything") { + Diags.setEnableAllWarnings(true); + continue; + } // -Wfatal-errors is yet another special case. if (Opt.startswith("fatal-errors")) { |