brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 1ee6311 Raw
44 lines · cpp
1// RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -strict-whitespace2 3#define NO_INITIATION(x) int a = x * 24#define NO_DEFINITION(x) int c = x * 25 6NO_INITIATION(a);7NO_DEFINITION(b);8 9// CHECK: {{.*}}:6:15: warning: variable 'a' is uninitialized when used within its own initialization10// 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 * 214// 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 + 122#define ADD(x,y) y + F(x)23#define SWAP_ARGU(x,y) ADD(y,x)24 25int  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 y32 33struct node {34};35 36node ff;37 38int 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 y44// CHECK-NEXT:                      ~ ^ ~