Clang Project

clang_source_code/test/Preprocessor/c99-6_10_3_4_p5.c
1// Example from C99 6.10.3.4p5
2// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
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); 
21p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; 
22char c[2][6] = { str(hello), str() }; 
23
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", "" };
28
29