[cfe-commits] r148300 - in /cfe/trunk: lib/Frontend/Warnings.cpp test/Sema/format-strings-scanf.c

Hans Wennborg hans at hanshq.net
Tue Jan 17 01:30:38 PST 2012


Author: hans
Date: Tue Jan 17 03:30:38 2012
New Revision: 148300

URL: http://llvm.org/viewvc/llvm-project?rev=148300&view=rev
Log:
Treat -Wformat=0 as an alias for -Wformat.

Fixes PR9195.

Modified:
    cfe/trunk/lib/Frontend/Warnings.cpp
    cfe/trunk/test/Sema/format-strings-scanf.c

Modified: cfe/trunk/lib/Frontend/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Warnings.cpp?rev=148300&r1=148299&r2=148300&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Warnings.cpp (original)
+++ cfe/trunk/lib/Frontend/Warnings.cpp Tue Jan 17 03:30:38 2012
@@ -83,6 +83,10 @@
     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;

Modified: cfe/trunk/test/Sema/format-strings-scanf.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings-scanf.c?rev=148300&r1=148299&r2=148300&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings-scanf.c (original)
+++ cfe/trunk/test/Sema/format-strings-scanf.c Tue Jan 17 03:30:38 2012
@@ -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;





More information about the cfe-commits mailing list