From: Alex Lorenz Date: Fri, 28 Apr 2017 14:45:25 +0000 (+0000) Subject: Use the -Wunknown-warning-option group for the "unknown warning group" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de4f6266fade0d8f77731f96f027c7a10b6f36e2;p=clang Use the -Wunknown-warning-option group for the "unknown warning group" diagnostic in #pragma diagnostic This matches the warning group that's specified for the unknown warning options that are passed-in as command line arguments. rdar://29526025 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301647 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index cf33d5fba3..653be75a76 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -503,7 +503,7 @@ def warn_pragma_diagnostic_invalid_token : InGroup; def warn_pragma_diagnostic_unknown_warning : ExtWarn<"unknown warning group '%0', ignored">, - InGroup; + InGroup; // - #pragma __debug def warn_pragma_debug_unexpected_command : Warning< "unexpected debug command '%0'">, InGroup; diff --git a/test/Preprocessor/pragma_diagnostic.c b/test/Preprocessor/pragma_diagnostic.c index 3970dbbc8e..63d5907c67 100644 --- a/test/Preprocessor/pragma_diagnostic.c +++ b/test/Preprocessor/pragma_diagnostic.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef -Wno-unknown-warning-option -DAVOID_UNKNOWN_WARNING %s // rdar://2362963 #if FOO // ok. @@ -28,8 +29,10 @@ #pragma GCC diagnostic error "-Wundef" 42 // expected-warning {{unexpected token in pragma diagnostic}} #pragma GCC diagnostic error "invalid-name" // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}} -#pragma GCC diagnostic error "-Winvalid-name" // expected-warning {{unknown warning group '-Winvalid-name', ignored}} - +#pragma GCC diagnostic error "-Winvalid-name" +#ifndef AVOID_UNKNOWN_WARNING +// expected-warning@-2 {{unknown warning group '-Winvalid-name', ignored}} +#endif // Testing pragma clang diagnostic with -Weverything void ppo(){} // First test that we do not diagnose on this.