2015-02-26 08:17:25 +08:00
|
|
|
// RUN: %clang_cc1 -fms-extensions -std=c++11 -E %s -fuse-line-directives | FileCheck %s
|
2010-09-10 06:45:38 +08:00
|
|
|
|
|
|
|
// Test that we properly expand the C99 _Pragma and Microsoft __pragma
|
|
|
|
// into #pragma directives, with newlines where needed. <rdar://problem/8412013>
|
|
|
|
|
|
|
|
// CHECK: #line
|
|
|
|
// CHECK: #pragma warning(push)
|
2010-09-11 06:27:29 +08:00
|
|
|
// CHECK: extern "C" {
|
2010-09-10 06:45:38 +08:00
|
|
|
// CHECK: #line
|
2010-09-11 06:27:29 +08:00
|
|
|
// CHECK: #pragma warning(push)
|
|
|
|
// CHECK: int foo() { return 0; } }
|
2010-09-10 06:45:38 +08:00
|
|
|
// CHECK: #pragma warning(pop)
|
2010-09-11 06:27:29 +08:00
|
|
|
#define A(X) extern "C" { __pragma(warning(push)) \
|
|
|
|
int X() { return 0; } \
|
|
|
|
}
|
|
|
|
#define B(X) A(X)
|
|
|
|
#pragma warning(push)
|
|
|
|
B(foo)
|
|
|
|
#pragma warning(pop)
|
2013-03-10 07:30:15 +08:00
|
|
|
|
|
|
|
#define pragma_L _Pragma(L"GCC diagnostic push")
|
|
|
|
#define pragma_u8 _Pragma(u8"system_header")
|
|
|
|
#define pragma_u _Pragma(u"GCC diagnostic pop")
|
|
|
|
#define pragma_U _Pragma(U"comment(lib, \"libfoo\")")
|
|
|
|
#define pragma_R _Pragma(R"(clang diagnostic ignored "-Wunused")")
|
|
|
|
#define pragma_UR _Pragma(UR"(clang diagnostic error "-Wunused")")
|
|
|
|
#define pragma_hello _Pragma(u8R"x(message R"y("Hello", world!)y")x")
|
|
|
|
// CHECK: int n =
|
|
|
|
// CHECK: #pragma GCC diagnostic push
|
|
|
|
// CHECK: #pragma system_header
|
|
|
|
// CHECK: #pragma GCC diagnostic pop
|
|
|
|
// CHECK: #pragma comment(lib, "libfoo")
|
|
|
|
// CHECK: #pragma clang diagnostic ignored "-Wunused"
|
|
|
|
// CHECK: #pragma clang diagnostic error "-Wunused"
|
2013-04-20 01:13:17 +08:00
|
|
|
// CHECK: #pragma message("\042Hello\042, world!")
|
2013-03-10 07:30:15 +08:00
|
|
|
// CHECK: 0;
|
|
|
|
int n = pragma_L pragma_u8 pragma_u pragma_U pragma_R pragma_UR pragma_hello 0;
|
2013-09-14 06:00:30 +08:00
|
|
|
|
|
|
|
#pragma warning(disable : 1 2L 3U ; error : 4 5 6 ; suppress : 7 8 9)
|
|
|
|
// CHECK: #pragma warning(disable: 1 2 3)
|
|
|
|
// CHECK: #line [[@LINE-2]]
|
|
|
|
// CHECK: #pragma warning(error: 4 5 6)
|
|
|
|
// CHECK: #line [[@LINE-4]]
|
|
|
|
// CHECK: #pragma warning(suppress: 7 8 9)
|
|
|
|
|
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(push, 1L)
|
|
|
|
#pragma warning(push, 4U)
|
|
|
|
#pragma warning(push, 0x1)
|
|
|
|
#pragma warning(push, 03)
|
|
|
|
#pragma warning(push, 0b10)
|
|
|
|
#pragma warning(push, 1i8)
|
|
|
|
// CHECK: #pragma warning(push)
|
|
|
|
// CHECK: #pragma warning(push, 1)
|
|
|
|
// CHECK: #pragma warning(push, 4)
|
|
|
|
// CHECK: #pragma warning(push, 1)
|
|
|
|
// CHECK: #pragma warning(push, 3)
|
|
|
|
// CHECK: #pragma warning(push, 2)
|
|
|
|
// CHECK: #pragma warning(push, 1)
|