xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/if_warning.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -Eonly -Werror=undef -verify
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -Eonly -Werror-undef -verify
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc extern int x;
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc #if foo   // expected-error {{'foo' is not defined, evaluates to 0}}
7*f4a2713aSLionel Sambuc #endif
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc #ifdef foo
10*f4a2713aSLionel Sambuc #endif
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc #if defined(foo)
13*f4a2713aSLionel Sambuc #endif
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // PR3938
17*f4a2713aSLionel Sambuc #if 0
18*f4a2713aSLionel Sambuc #ifdef D
19*f4a2713aSLionel Sambuc #else 1       // Should not warn due to C99 6.10p4
20*f4a2713aSLionel Sambuc #endif
21*f4a2713aSLionel Sambuc #endif
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // rdar://9475098
24*f4a2713aSLionel Sambuc #if 0
25*f4a2713aSLionel Sambuc #else 1   // expected-warning {{extra tokens}}
26*f4a2713aSLionel Sambuc #endif
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc // PR6852
29*f4a2713aSLionel Sambuc #if 'somesillylongthing'  // expected-warning {{character constant too long for its type}} \
30*f4a2713aSLionel Sambuc                           // expected-warning {{multi-character character constant}}
31*f4a2713aSLionel Sambuc #endif
32