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