Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | // Example from C99 6.10.3.4p5 |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3 | |
| 4 | #define x 3 |
| 5 | #define f(a) f(x * (a)) |
| 6 | #undef x |
| 7 | #define x 2 |
| 8 | #define g f |
| 9 | #define z z[0] |
| 10 | #define h g(~ |
| 11 | #define m(a) a(w) |
| 12 | #define w 0,1 |
| 13 | #define t(a) a |
| 14 | #define p() int |
| 15 | #define q(x) x |
| 16 | #define r(x,y) x ## y |
| 17 | #define str(x) # x |
| 18 | f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); |
| 19 | g(x+(3,4)-w) | h 5) & m |
| 20 | (f)^m(m); |
| 21 | p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; |
| 22 | char c[2][6] = { str(hello), str() }; |
| 23 | |
Edward O'Callaghan | b396a37 | 2009-10-27 02:36:32 +0000 | [diff] [blame] | 24 | // CHECK: f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); |
| 25 | // CHECK: f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); |
| 26 | // CHECK: int i[] = { 1, 23, 4, 5, }; |
| 27 | // CHECK: char c[2][6] = { "hello", "" }; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 28 | |