xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/disabled-cond-diags2.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -Eonly -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc #if 0
4*f4a2713aSLionel Sambuc #if 1
5*f4a2713aSLionel Sambuc #endif junk // shouldn't produce diagnostics
6*f4a2713aSLionel Sambuc #endif
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc #if 0
9*f4a2713aSLionel Sambuc #endif junk // expected-warning{{extra tokens at end of #endif directive}}
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc #if 1 junk  // expected-error{{token is not a valid binary operator in a preprocessor subexpression}}
12*f4a2713aSLionel Sambuc #X          // shouldn't produce diagnostics (block #if condition not valid, so skipped)
13*f4a2713aSLionel Sambuc #else
14*f4a2713aSLionel Sambuc #X          // expected-error{{invalid preprocessing directive}}
15*f4a2713aSLionel Sambuc #endif
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc #if 0
18*f4a2713aSLionel Sambuc // diagnostics should not be produced until final #endif
19*f4a2713aSLionel Sambuc #X
20*f4a2713aSLionel Sambuc #include
21*f4a2713aSLionel Sambuc #if 1 junk
22*f4a2713aSLionel Sambuc #else junk
23*f4a2713aSLionel Sambuc #endif junk
24*f4a2713aSLionel Sambuc #line -2
25*f4a2713aSLionel Sambuc #error
26*f4a2713aSLionel Sambuc #warning
27*f4a2713aSLionel Sambuc #endif junk // expected-warning{{extra tokens at end of #endif directive}}
28