1 /* n_10.c:  #if, #elif, #else and #endif pp-directive.  */
2 
3 #include    "defs.h"
4 
5 #define MACRO_0     0
6 #define MACRO_1     1
7 
main(void)8 main( void)
9 {
10     fputs( "started\n", stderr);
11 
12 /* 10.1:    */
13 /* Note: an undefined identifier in #if expression is replaced to 0.    */
14 #if     a
15     assert( a);
16 #elif   MACRO_0
17     assert( MACRO_0);
18 #elif   MACRO_1         /* Valid block  */
19     assert( MACRO_1);
20 #else
21     assert( 0);
22 #endif
23 
24 /* 10.2: Comments must be processed even if in skipped #if block.   */
25 /* At least tokenization of string literal and character constant is necessary
26         to process comments, e.g. /* is not a comment mark in string literal.
27  */
28 #ifdef  UNDEFINED
29     /* Comment  */
30     "in literal /* is not a comment"
31 #endif
32 
33     fputs( "success\n", stderr);
34     return  0;
35 }
36 
37