Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
- Currently also enables the behavior that allows silent redefinition
of types in system headers. Conceptually these are separate but I
didn't feel it was worth two options (or changing LangOptions).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index ef12eaf..0efe56a 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -520,6 +520,11 @@
llvm::cl::desc("Issue an error on uses of GCC extensions"));
static llvm::cl::opt<bool>
+SuppressSystemWarnings("suppress-system-warnings",
+ llvm::cl::desc("Issue an error on uses of GCC extensions"),
+ llvm::cl::init(true));
+
+static llvm::cl::opt<bool>
WarnUnusedMacros("Wunused_macros",
llvm::cl::desc("Warn for unused macros in the main translation unit"));
@@ -547,6 +552,9 @@
Diags.setWarnOnExtensions(WarnOnExtensions);
Diags.setErrorOnExtensions(ErrorOnExtensions);
+ // Suppress warnings in system headers unless requested not to.
+ Diags.setSuppressSystemWarnings(SuppressSystemWarnings);
+
// Silence the "macro is not used" warning unless requested.
if (!WarnUnusedMacros)
Diags.setDiagnosticMapping(diag::pp_macro_not_used, diag::MAP_IGNORE);