xref: /llvm-project/clang/test/Preprocessor/stringize_space.c (revision ae6b40000238e5faaaa319ffcfc713a15e459be8)
1 // RUN: %clang_cc1 -E %s | FileCheck --strict-whitespace %s
2 // RUN: %clang_cc1 -E -P -fminimize-whitespace %s | FileCheck --strict-whitespace %s --check-prefix=MINWS
3 
4 #define A(b) -#b  ,  - #b  ,  -# b  ,  - # b
5 A()
6 
7 // CHECK: {{^}}-"" , - "" , -"" , - ""{{$}}
8 // MINWS: {{^}}-"",-"",-"",-""
9 
10 #define t(x) #x
11 t(a
12 c)
13 
14 // CHECK: {{^}}"a c"{{$}}
15 // MINWS-SAME: "a c"
16 
17 #define str(x) #x
18 #define f(x) str(-x)
19 f(
20     1)
21 
22 // CHECK: {{^}}"-1"
23 // MINWS-SAME: "-1"
24 
25 #define paste(a,b) str(a<b##ld)
26 paste(hello1, wor)
27 paste(hello2,
28       wor)
29 paste(hello3,
30 wor)
31 
32 // CHECK: {{^}}"hello1<world"
33 // CHECK: {{^}}"hello2<world"
34 // CHECK: {{^}}"hello3<world"
35 // MINWS-SAME: {{^}}"hello1<world""hello2<world""hello3<world"{{$}}
36