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