1// RUN: %clang_cc1 -verify -fms-extensions -Wmicrosoft %s
2// RUN: not %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
3
4// This horrible stuff should preprocess into (other than whitespace):
5//   int foo;
6//   int bar;
7//   int baz;
8
9int foo;
10
11// CHECK: int foo;
12
13#define comment /##/  dead tokens live here
14// expected-warning@+1 {{pasting two '/' tokens}}
15comment This is stupidity
16
17int bar;
18
19// CHECK: int bar;
20
21#define nested(x) int x comment cute little dead tokens...
22
23// expected-warning@+1 {{pasting two '/' tokens}}
24nested(baz)  rise of the dead tokens
25
26;
27
28// CHECK: int baz
29// CHECK: ;
30
31
32// rdar://8197149 - VC++ allows invalid token pastes: (##baz
33#define foo(x) abc(x)
34#define bar(y) foo(##baz(y))
35bar(q) // expected-warning {{type specifier missing}} expected-error {{invalid preprocessing token}} expected-error {{parameter list without types}}
36
37// CHECK: abc(baz(q))
38
39
40#define str(x) #x
41#define collapse_spaces(a, b, c, d) str(a ## - ## b ## - ## c ## d)
42collapse_spaces(1a, b2, 3c, d4) // expected-error 4 {{invalid preprocessing token}} expected-error {{expected function body}}
43
44// CHECK: "1a-b2-3cd4"
45