]> granicus.if.org Git - clang/commitdiff
Treat -Wformat=0 as an alias for -Wformat.
authorHans Wennborg <hans@hanshq.net>
Tue, 17 Jan 2012 09:30:38 +0000 (09:30 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 17 Jan 2012 09:30:38 +0000 (09:30 +0000)
Fixes PR9195.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148300 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/Warnings.cpp
test/Sema/format-strings-scanf.c

index 6f441112f361df80f461adbdbf5b6437f79e667f..576dd3d445992944e71b7f67d17ccf5efb687a5d 100644 (file)
@@ -83,6 +83,10 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
     for (unsigned i = 0, e = Opts.Warnings.size(); i != e; ++i) {
       StringRef Opt = Opts.Warnings[i];
 
+      // Treat -Wformat=0 as an alias for -Wno-format.
+      if (Opt == "format=0")
+        Opt = "no-format";
+
       // Check to see if this warning starts with "no-", if so, this is a
       // negative form of the option.
       bool isPositive = true;
index 4d9843cd7908752c28bc16fca13dd3873a1e1633..be70357560ca94809f49a2d821260ff443c8c357 100644 (file)
@@ -1,5 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -Wformat-nonliteral %s
 
+// Test that -Wformat=0 works:
+// RUN: %clang_cc1 -fsyntax-only -Werror -Wformat=0 %s
+
 #include <stdarg.h>
 typedef __typeof(sizeof(int)) size_t;
 typedef struct _FILE FILE;