2015-12-30 07:06:17 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fms-extensions -Wmicrosoft %s
|
2013-07-05 00:16:58 +08:00
|
|
|
// RUN: not %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
|
2010-07-18 00:24:30 +08:00
|
|
|
|
2008-02-07 14:03:59 +08:00
|
|
|
// This horrible stuff should preprocess into (other than whitespace):
|
|
|
|
// int foo;
|
|
|
|
// int bar;
|
|
|
|
// int baz;
|
|
|
|
|
|
|
|
int foo;
|
|
|
|
|
2009-10-27 10:36:32 +08:00
|
|
|
// CHECK: int foo;
|
|
|
|
|
2008-02-07 14:03:59 +08:00
|
|
|
#define comment /##/ dead tokens live here
|
2015-12-30 07:06:17 +08:00
|
|
|
// expected-warning@+1 {{pasting two '/' tokens}}
|
2008-02-07 14:03:59 +08:00
|
|
|
comment This is stupidity
|
|
|
|
|
|
|
|
int bar;
|
|
|
|
|
2009-10-27 10:36:32 +08:00
|
|
|
// CHECK: int bar;
|
|
|
|
|
2008-02-07 14:03:59 +08:00
|
|
|
#define nested(x) int x comment cute little dead tokens...
|
|
|
|
|
2015-12-30 07:06:17 +08:00
|
|
|
// expected-warning@+1 {{pasting two '/' tokens}}
|
2008-02-07 14:03:59 +08:00
|
|
|
nested(baz) rise of the dead tokens
|
|
|
|
|
|
|
|
;
|
|
|
|
|
2009-10-27 10:36:32 +08:00
|
|
|
// CHECK: int baz
|
|
|
|
// CHECK: ;
|
|
|
|
|
2010-07-18 00:24:30 +08:00
|
|
|
|
|
|
|
// rdar://8197149 - VC++ allows invalid token pastes: (##baz
|
|
|
|
#define foo(x) abc(x)
|
|
|
|
#define bar(y) foo(##baz(y))
|
2015-12-30 07:06:17 +08:00
|
|
|
bar(q) // expected-warning {{type specifier missing}} expected-error {{invalid preprocessing token}} expected-error {{parameter list without types}}
|
2010-07-18 00:24:30 +08:00
|
|
|
|
|
|
|
// CHECK: abc(baz(q))
|
2015-04-17 20:43:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
#define str(x) #x
|
|
|
|
#define collapse_spaces(a, b, c, d) str(a ## - ## b ## - ## c ## d)
|
2015-12-30 07:06:17 +08:00
|
|
|
collapse_spaces(1a, b2, 3c, d4) // expected-error 4 {{invalid preprocessing token}} expected-error {{expected function body}}
|
2015-04-17 20:43:57 +08:00
|
|
|
|
|
|
|
// CHECK: "1a-b2-3cd4"
|