Blame cpp-test/test-t/n_10.c

Packit Service 8bf002
/* n_10.c:  #if, #elif, #else and #endif pp-directive.  */
Packit Service 8bf002
Packit Service 8bf002
#define MACRO_0     0
Packit Service 8bf002
#define MACRO_1     1
Packit Service 8bf002
Packit Service 8bf002
/* 10.1:    */
Packit Service 8bf002
/* Note: an undefined identifier in #if expression is replaced to 0.    */
Packit Service 8bf002
/*  1;  */
Packit Service 8bf002
#if     a
Packit Service 8bf002
    a;
Packit Service 8bf002
#elif   MACRO_0
Packit Service 8bf002
    MACRO_0;
Packit Service 8bf002
#elif   MACRO_1         /* Valid block  */
Packit Service 8bf002
    MACRO_1;
Packit Service 8bf002
#else
Packit Service 8bf002
    0;
Packit Service 8bf002
#endif
Packit Service 8bf002
Packit Service 8bf002
/* 10.2:    Comments must be processed even if in skipped #if block.    */
Packit Service 8bf002
/* At least tokenization of string literal and character constant is necessary
Packit Service 8bf002
        to process comments, e.g. /* is not a comment mark in string literal.
Packit Service 8bf002
 */
Packit Service 8bf002
#ifdef  UNDEFINED
Packit Service 8bf002
    /* Comment  */
Packit Service 8bf002
    "in literal /* is not a comment"
Packit Service 8bf002
#endif  /* No excess-errors */
Packit Service 8bf002
Packit Service 8bf002
/* { dg-do preprocess }
Packit Service 8bf002
   { dg-options "-ansi -w" }
Packit Service 8bf002
   { dg-final { if ![file exist n_10.i] { return }                      } }
Packit Service 8bf002
   { dg-final { if \{ [grep n_10.i "1" ] != ""                  \} \{   } }
Packit Service 8bf002
   { dg-final { return \}                                               } }
Packit Service 8bf002
   { dg-final { fail "n_10.c: #if, #elif, #else and #endif"             } }
Packit Service 8bf002
 */
Packit Service 8bf002