xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/macro_disable.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -E | FileCheck -strict-whitespace %s
2*f4a2713aSLionel Sambuc // Check for C99 6.10.3.4p2.
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #define f(a) f(x * (a))
5*f4a2713aSLionel Sambuc #define x 2
6*f4a2713aSLionel Sambuc #define z z[0]
7*f4a2713aSLionel Sambuc f(f(z));
8*f4a2713aSLionel Sambuc // CHECK: f(2 * (f(2 * (z[0]))));
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc #define A A B C
13*f4a2713aSLionel Sambuc #define B B C A
14*f4a2713aSLionel Sambuc #define C C A B
15*f4a2713aSLionel Sambuc A
16*f4a2713aSLionel Sambuc // CHECK: A B C A B A C A B C A
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // PR1820
20*f4a2713aSLionel Sambuc #define i(x) h(x
21*f4a2713aSLionel Sambuc #define h(x) x(void)
22*f4a2713aSLionel Sambuc extern int i(i));
23*f4a2713aSLionel Sambuc // CHECK: int i(void)
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc #define M_0(x) M_ ## x
27*f4a2713aSLionel Sambuc #define M_1(x) x + M_0(0)
28*f4a2713aSLionel Sambuc #define M_2(x) x + M_1(1)
29*f4a2713aSLionel Sambuc #define M_3(x) x + M_2(2)
30*f4a2713aSLionel Sambuc #define M_4(x) x + M_3(3)
31*f4a2713aSLionel Sambuc #define M_5(x) x + M_4(4)
32*f4a2713aSLionel Sambuc 
33*f4a2713aSLionel Sambuc a: M_0(1)(2)(3)(4)(5);
34*f4a2713aSLionel Sambuc b: M_0(5)(4)(3)(2)(1);
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc // CHECK: a: 2 + M_0(3)(4)(5);
37*f4a2713aSLionel Sambuc // CHECK: b: 4 + 4 + 3 + 2 + 1 + M_0(3)(2)(1);
38*f4a2713aSLionel Sambuc 
39*f4a2713aSLionel Sambuc #define n(v) v
40*f4a2713aSLionel Sambuc #define l m
41*f4a2713aSLionel Sambuc #define m l a
42*f4a2713aSLionel Sambuc c: n(m) X
43*f4a2713aSLionel Sambuc // CHECK: c: m a X
44