]> granicus.if.org Git - clang/commitdiff
Fix PR4007: clang doesn't know -Werror-foo is the same as -Werror=foo
authorChris Lattner <sabre@nondot.org>
Sun, 19 Apr 2009 22:07:21 +0000 (22:07 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 19 Apr 2009 22:07:21 +0000 (22:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69557 91177308-0d34-0410-b5e6-96231b3b80d8

test/Preprocessor/if_warning.c
tools/clang-cc/Warnings.cpp

index 5fc8c347a6c4274e1e8f5effda0189ab64d254b5..5567513c36306243fe6a32737eed0ad7441c774c 100644 (file)
@@ -1,4 +1,5 @@
-// RUN: clang-cc %s -Eonly -Werror=undef -verify
+// RUN: clang-cc %s -Eonly -Werror=undef -verify &&
+// RUN: clang-cc %s -Eonly -Werror-undef -verify
 
 extern int x;
 
index 62bf467f0d8260849fc373ecdfc37bd19f25af3c..1ae122dc7a36d14fe81314729b1e5fd1a14eeda0 100644 (file)
@@ -121,11 +121,12 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags) {
     }
     
     // -Werror/-Wno-error is a special case, not controlled by the option table.
-    // It also has the "specifier" form of -Werror=foo.
+    // It also has the "specifier" form of -Werror=foo and -Werror-foo.
     if (OptEnd-OptStart >= 5 && memcmp(OptStart, "error", 5) == 0) {
       const char *Specifier = 0;
       if (OptEnd-OptStart != 5) {  // Specifier must be present.
-        if (OptStart[5] != '=' || OptEnd-OptStart == 6) {
+        if ((OptStart[5] != '=' && OptStart[5] != '-') ||
+            OptEnd-OptStart == 6) {
           fprintf(stderr, "warning: unknown -Werror warning specifier: -W%s\n",
                   Opt.c_str());
           continue;