Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Misc / reduced-diags-macros.cpp
blob1ee6311d1980e7ade71159750c474dd06db8f0fc
1 // RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -strict-whitespace
3 #define NO_INITIATION(x) int a = x * 2
4 #define NO_DEFINITION(x) int c = x * 2
6 NO_INITIATION(a);
7 NO_DEFINITION(b);
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: ~ ^
16 // CHECK: {{.*}}:7:15: error: use of undeclared identifier 'b'
17 // CHECK-NEXT: NO_DEFINITION(b);
18 // CHECK-NEXT: ^
21 #define F(x) x + 1
22 #define ADD(x,y) y + F(x)
23 #define SWAP_ARGU(x,y) ADD(y,x)
25 int p = SWAP_ARGU(3, x);
27 // CHECK: {{.*}}:25:23: error: use of undeclared identifier 'x'
28 // CHECK-NEXT: int p = SWAP_ARGU(3, x);
29 // CHECK-NEXT: ^
31 #define APPLY(f,x,y) x f y
33 struct node {
36 node ff;
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: ~ ^ ~