Skip to content

Commit 1b36842

Browse files
author
arphaman
committed
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: http://llvm.org/svn/llvm-project/cfe/trunk@301647 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b174a3d commit 1b36842

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def warn_pragma_diagnostic_invalid_token :
503503
InGroup<UnknownPragmas>;
504504
def warn_pragma_diagnostic_unknown_warning :
505505
ExtWarn<"unknown warning group '%0', ignored">,
506-
InGroup<UnknownPragmas>;
506+
InGroup<UnknownWarningOption>;
507507
// - #pragma __debug
508508
def warn_pragma_debug_unexpected_command : Warning<
509509
"unexpected debug command '%0'">, InGroup<IgnoredPragmas>;

test/Preprocessor/pragma_diagnostic.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s
2+
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef -Wno-unknown-warning-option -DAVOID_UNKNOWN_WARNING %s
23
// rdar://2362963
34

45
#if FOO // ok.
@@ -28,8 +29,10 @@
2829
#pragma GCC diagnostic error "-Wundef" 42 // expected-warning {{unexpected token in pragma diagnostic}}
2930
#pragma GCC diagnostic error "invalid-name" // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}}
3031

31-
#pragma GCC diagnostic error "-Winvalid-name" // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
32-
32+
#pragma GCC diagnostic error "-Winvalid-name"
33+
#ifndef AVOID_UNKNOWN_WARNING
34+
// expected-warning@-2 {{unknown warning group '-Winvalid-name', ignored}}
35+
#endif
3336

3437
// Testing pragma clang diagnostic with -Weverything
3538
void ppo(){} // First test that we do not diagnose on this.

0 commit comments

Comments
 (0)