1 | // Example from C99 6.10.3.4p6 |
2 | |
3 | // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s |
4 | |
5 | #define str(s) # s |
6 | #define xstr(s) str(s) |
7 | #define debug(s, t) printf("x" # s "= %d, x" # t "= s" \ |
8 | x ## s, x ## t) |
9 | #define INCFILE(n) vers ## n |
10 | #define glue(a, b) a ## b |
11 | #define xglue(a, b) glue(a, b) |
12 | #define HIGHLOW "hello" |
13 | #define LOW LOW ", world" |
14 | debug(1, 2); |
15 | fputs(str(strncmp("abc\0d" "abc", '\4') // this goes away |
16 | == 0) str(: @\n), s); |
17 | include xstr(INCFILE(2).h) |
18 | glue(HIGH, LOW); |
19 | xglue(HIGH, LOW) |
20 | |
21 | |
22 | // CHECK: printf("x" "1" "= %d, x" "2" "= s" x1, x2); |
23 | // CHECK: fputs("strncmp(\"abc\\0d\" \"abc\", '\\4') == 0" ": @\n", s); |
24 | // CHECK: include "vers2.h" |
25 | // CHECK: "hello"; |
26 | // CHECK: "hello" ", world" |
27 | |
28 | |