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

Packit b40e2e
/* n_nularg.c:  Empty argument of macro call.   */
Packit b40e2e
Packit b40e2e
#define ARG( a)         # a
Packit b40e2e
#define EMPTY
Packit b40e2e
#define SHOWN( n)       printf( "%s : %d\n", # n, n)
Packit b40e2e
#define SHOWS( s)       printf( "%s : %s\n", # s, ARG( s))
Packit b40e2e
#define add( a, b)      (a + b)
Packit b40e2e
#define sub( a, b)      (a - b)
Packit b40e2e
#define math( op, a, b)     op( a, b)
Packit b40e2e
#define APPEND( a, b)       a ## b
Packit b40e2e
Packit b40e2e
/*  printf( "%s : %d\n", "math( sub, , y)", ( - y));    */
Packit b40e2e
    SHOWN( math( sub, , y));
Packit b40e2e
Packit b40e2e
/*  printf( "%s : %s\n", "EMPTY", "");  */
Packit b40e2e
    SHOWS( EMPTY);
Packit b40e2e
Packit b40e2e
/*  printf( "%s : %s\n", "APPEND( CON, 1)", "CON1");    */
Packit b40e2e
    SHOWS( APPEND( CON, 1));
Packit b40e2e
Packit b40e2e
/*  printf( "%s : %s\n", "APPEND( , )", "");  */
Packit b40e2e
    SHOWS( APPEND( , ));
Packit b40e2e
Packit b40e2e
/* { dg-do preprocess }
Packit b40e2e
   { dg-options "-std=c99 -w" }
Packit b40e2e
   { dg-final { if ![file exist n_nularg.i] { return }                  } }
Packit b40e2e
   { dg-final { if \{ [grep n_nularg.i "printf\\( \"%s : %d\\\\n\", \"math\\( sub, , y\\)\", *\\( *- *y *\\) *\\)" ] != ""  \} \{   } }
Packit b40e2e
   { dg-final { if \{ [grep n_nularg.i "printf\\( \"%s : %s\\\\n\", \"EMPTY\", *\"\" *\\)" ] != ""  \} \{   } }
Packit b40e2e
   { dg-final { if \{ [grep n_nularg.i "printf\\( \"%s : %s\\\\n\", \"APPEND\\( CON, 1\\)\", *\"CON1\" *\\)" ] != ""    \} \{   } }
Packit b40e2e
   { dg-final { if \{ [grep n_nularg.i "printf\\( \"%s : %s\\\\n\", \"APPEND\\( , \\)\", *\"\" *\\)" ] != ""        \} \{   } }
Packit b40e2e
   { dg-final { return \} \} \} \}                                      } }
Packit b40e2e
   { dg-final { fail "n_nularg.c: empty argument"                       } }
Packit b40e2e
 */
Packit b40e2e