gcc/testsuite/gcc.dg/cpp/strp2.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | /* Test for odd corner cases in stringizing/pasting. |
| 4 | Taken more or less verbatim from C99 section 6.10.3.3. */ |
| 5 | |
| 6 | #include <stdlib.h> |
| 7 | #include <string.h> |
| 8 | |
| 9 | #define hash_hash # ## # |
| 10 | #define mkstr(a) # a |
| 11 | #define in_between(a) mkstr(a) |
| 12 | #define join(c, d) in_between(c hash_hash d) |
| 13 | |
| 14 | const char p[] = join(x, y); |
| 15 | const char q[] = "x ## y"; |
| 16 | |
| 17 | int |
| 18 | main (void) |
| 19 | { |
| 20 | if (strcmp (p, q)) |
| 21 | abort (); |
| 22 | return 0; |
| 23 | } |