Hi all,
The attached patch makes Clang treat -Wformat=0 as an alias for
-Wno-format, as requested in PR9195.
Please let me know if this is desirable and ok to commit. (Also if
there is a better way of testing it.)
Thanks,
Hans
diff --git a/lib/Frontend/Warnings.cpp b/lib/Frontend/Warnings.cpp
index 6f44111..576dd3d 100644
--- a/lib/Frontend/Warnings.cpp
+++ b/lib/Frontend/Warnings.cpp
@@ -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;
diff --git a/test/Sema/format-strings-scanf.c b/test/Sema/format-strings-scanf.c
index 4d9843c..be70357 100644
--- a/test/Sema/format-strings-scanf.c
+++ b/test/Sema/format-strings-scanf.c
@@ -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;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits