From: Chris Lattner Date: Sun, 19 Apr 2009 22:07:21 +0000 (+0000) Subject: Fix PR4007: clang doesn't know -Werror-foo is the same as -Werror=foo X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b912d9832606a040bb3b56a66301863a6548338;p=clang Fix PR4007: clang doesn't know -Werror-foo is the same as -Werror=foo git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69557 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Preprocessor/if_warning.c b/test/Preprocessor/if_warning.c index 5fc8c347a6..5567513c36 100644 --- a/test/Preprocessor/if_warning.c +++ b/test/Preprocessor/if_warning.c @@ -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; diff --git a/tools/clang-cc/Warnings.cpp b/tools/clang-cc/Warnings.cpp index 62bf467f0d..1ae122dc7a 100644 --- a/tools/clang-cc/Warnings.cpp +++ b/tools/clang-cc/Warnings.cpp @@ -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;