1/* u_1_24.t:    Undefined behaviors on empty argument of macro call.    */
2
3/* u.1.24:  Empty argument of macro call.   */
4/*
5 *   Note: Since no argument and one empty argument cannot be distinguished
6 * syntactically, additional dummy argument may be necessary for an
7 * intermediate macro to process one empty argument (if possible).
8 */
9
10#define ARG( a, dummy)      # a
11#define EMPTY
12#define SHOWN( n)       printf( "%s : %d\n", # n, n)
13#define SHOWS( s)       printf( "%s : %s\n", # s, ARG( s, dummy))
14#define add( a, b)      (a + b)
15#define sub( a, b)      (a - b)
16#define math( op, a, b)     op( a, b)
17#define APPEND( a, b)       a ## b
18
19/*  printf( "%s : %d\n", "math( sub, , y)", ( - y));
20        or other undefined behavior.    */
21    SHOWN( math( sub, , y));
22
23/*  printf( "%s : %s\n", "EMPTY", "");
24        or other undefined behavior.    */
25    SHOWS( EMPTY);
26
27/*  printf( "%s : %s\n", "APPEND( CON, 1)", "CON1");    */
28    SHOWS( APPEND( CON, 1));
29
30/*  printf( "%s : %s\n", "APPEND( CON, )", "CON");
31        or other undefined behavior.    */
32    SHOWS( APPEND( CON, ));
33
34/*  printf( "%s : %s\n", "APPEND( , )", "");
35        or other undefined behavior.    */
36    SHOWS( APPEND( , ));
37
38