Chris Lattner | c7cf27f | 2010-03-26 17:46:33 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s |
| 2 | // Check for C99 6.10.3.4p2. |
| 3 | |
| 4 | #define f(a) f(x * (a)) |
| 5 | #define x 2 |
| 6 | #define z z[0] |
| 7 | f(f(z)); |
| 8 | // CHECK: f(2 * (f(2 * (z[0])))); |
| 9 | |
| 10 | |
| 11 | |
| 12 | #define A A B C |
| 13 | #define B B C A |
| 14 | #define C C A B |
| 15 | A |
| 16 | // CHECK: A B C A B A C A B C A |
| 17 | |
| 18 | |
| 19 | // PR1820 |
| 20 | #define i(x) h(x |
| 21 | #define h(x) x(void) |
| 22 | extern int i(i)); |
| 23 | // CHECK: int i(void) |
| 24 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 25 | |
| 26 | #define M_0(x) M_ ## x |
| 27 | #define M_1(x) x + M_0(0) |
| 28 | #define M_2(x) x + M_1(1) |
| 29 | #define M_3(x) x + M_2(2) |
| 30 | #define M_4(x) x + M_3(3) |
| 31 | #define M_5(x) x + M_4(4) |
| 32 | |
| 33 | a: M_0(1)(2)(3)(4)(5); |
| 34 | b: M_0(5)(4)(3)(2)(1); |
| 35 | |
Chris Lattner | c7cf27f | 2010-03-26 17:46:33 +0000 | [diff] [blame^] | 36 | // CHECK: a: 2 + M_0(3)(4)(5); |
| 37 | // CHECK: b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1); |