1 // RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -strict-whitespace
2 
3 #define NO_INITIATION(x) int a = x * 2
4 #define NO_DEFINITION(x) int c = x * 2
5 
6 NO_INITIATION(a);
7 NO_DEFINITION(b);
8 
9 // CHECK: {{.*}}:6:15: warning: variable 'a' is uninitialized when used within its own initialization
10 // CHECK-NEXT: NO_INITIATION(a);
11 // CHECK-NEXT: ~~~~~~~~~~~~~~^~
12 // CHECK-NEXT: {{.*}}:3:34: note: expanded from macro 'NO_INITIATION'
13 // CHECK-NEXT: #define NO_INITIATION(x) int a = x * 2
14 // CHECK-NEXT:                              ~   ^
15 
16 // CHECK: {{.*}}:7:15: error: use of undeclared identifier 'b'
17 // CHECK-NEXT: NO_DEFINITION(b);
18 // CHECK-NEXT:               ^
19 
20 
21 #define F(x) x + 1
22 #define ADD(x,y) y + F(x)
23 #define SWAP_ARGU(x,y) ADD(y,x)
24 
25 int  p = SWAP_ARGU(3, x);
26 
27 // CHECK: {{.*}}:25:23: error: use of undeclared identifier 'x'
28 // CHECK-NEXT: int  p = SWAP_ARGU(3, x);
29 // CHECK-NEXT:                       ^
30 
31 #define APPLY(f,x,y) x f y
32 
33 struct node {
34 };
35 
36 node ff;
37 
38 int r = APPLY(+,ff,1);
39 // CHECK: {{.*}}:38:15: error: invalid operands to binary expression ('node' and 'int')
40 // CHECK-NEXT: int r = APPLY(+,ff,1);
41 // CHECK-NEXT:               ^ ~~ ~
42 // CHECK-NEXT: {{.*}}:31:24: note: expanded from macro 'APPLY'
43 // CHECK-NEXT: #define APPLY(f,x,y) x f y
44 // CHECK-NEXT:                      ~ ^ ~