]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Preprocessor/macro_paste_msextensions.c
Vendor import of clang trunk r238337:
[FreeBSD/FreeBSD.git] / test / Preprocessor / macro_paste_msextensions.c
1 // RUN: not %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
2
3 // This horrible stuff should preprocess into (other than whitespace):
4 //   int foo;
5 //   int bar;
6 //   int baz;
7
8 int foo;
9
10 // CHECK: int foo;
11
12 #define comment /##/  dead tokens live here
13 comment This is stupidity
14
15 int bar;
16
17 // CHECK: int bar;
18
19 #define nested(x) int x comment cute little dead tokens...
20
21 nested(baz)  rise of the dead tokens
22
23 ;
24
25 // CHECK: int baz
26 // CHECK: ;
27
28
29 // rdar://8197149 - VC++ allows invalid token pastes: (##baz
30 #define foo(x) abc(x)
31 #define bar(y) foo(##baz(y))
32 bar(q)
33
34 // CHECK: abc(baz(q))
35
36
37 #define str(x) #x
38 #define collapse_spaces(a, b, c, d) str(a ## - ## b ## - ## c ## d)
39 collapse_spaces(1a, b2, 3c, d4)
40
41 // CHECK: "1a-b2-3cd4"