xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/pragma_diagnostic.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s
2*f4a2713aSLionel Sambuc // rdar://2362963
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #if FOO    // ok.
5*f4a2713aSLionel Sambuc #endif
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc #pragma GCC diagnostic warning "-Wundef"
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc #if FOO    // expected-warning {{'FOO' is not defined}}
10*f4a2713aSLionel Sambuc #endif
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc #pragma GCC diagnostic ignored "-Wun" "def"
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc #if FOO    // ok.
15*f4a2713aSLionel Sambuc #endif
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc #pragma GCC diagnostic error "-Wundef"
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #if FOO    // expected-error {{'FOO' is not defined}}
20*f4a2713aSLionel Sambuc #endif
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc #define foo error
24*f4a2713aSLionel Sambuc #pragma GCC diagnostic foo "-Wundef"  // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc #pragma GCC diagnostic error 42  // expected-error {{expected string literal in pragma diagnostic}}
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc #pragma GCC diagnostic error "-Wundef" 42  // expected-warning {{unexpected token in pragma diagnostic}}
29*f4a2713aSLionel Sambuc #pragma GCC diagnostic error "invalid-name"  // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}}
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc #pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
32*f4a2713aSLionel Sambuc 
33