summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-12-17 17:50:07 +0000
committerTed Kremenek <kremenek@apple.com>2007-12-17 17:50:07 +0000
commit5aa66bdfd6ba96a4ebb56e334039b18f37aa70bb (patch)
tree0b82626b70f68fb04946f656b4589c08576d3576
parentfaebb6265166ed2f937d89424039cc98d88f8f02 (diff)
downloadbcm5719-llvm-5aa66bdfd6ba96a4ebb56e334039b18f37aa70bb.tar.gz
bcm5719-llvm-5aa66bdfd6ba96a4ebb56e334039b18f37aa70bb.zip
Added driver option -Wno-format-nonliteral to silence format string related
warnings. This flag is the inverse of to GCC's -Wformat-nonliteral option (in the clang driver, these warnings are on by default). Patch provided by Shantonu Sen. llvm-svn: 45103
-rw-r--r--clang/Driver/clang.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp
index 82247432118..fba375f353b 100644
--- a/clang/Driver/clang.cpp
+++ b/clang/Driver/clang.cpp
@@ -385,6 +385,10 @@ static llvm::cl::opt<bool>
WarnFloatEqual("Wfloat-equal",
llvm::cl::desc("Warn about equality comparisons of floating point values."));
+static llvm::cl::opt<bool>
+WarnNoFormatNonLiteral("Wno-format-nonliteral",
+ llvm::cl::desc("Do not warn about non-literal format strings."));
+
/// InitializeDiagnostics - Initialize the diagnostic object, based on the
/// current command line option settings.
static void InitializeDiagnostics(Diagnostic &Diags) {
@@ -399,6 +403,11 @@ static void InitializeDiagnostics(Diagnostic &Diags) {
// Silence "floating point comparison" warnings unless requested.
if (!WarnFloatEqual)
Diags.setDiagnosticMapping(diag::warn_floatingpoint_eq, diag::MAP_IGNORE);
+
+ // Silence "format string is not a string literal" warnings if requested
+ if (WarnNoFormatNonLiteral)
+ Diags.setDiagnosticMapping(diag::warn_printf_not_string_constant, diag::MAP_IGNORE);
+
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud