Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | // Example from C99 6.10.3.4p6 |
| 2 | |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 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 | |
Edward O'Callaghan | b396a37 | 2009-10-27 02:36:32 +0000 | [diff] [blame] | 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 | |