Parse: Don't attempt to act on #pragma init_seg when not targeting MSVC
It doesn't really make sense to try and do stuff with #pragma init_seg
when targeting non-Microsoft platforms; notions like library vs user
initializers don't exist for other targets.
This fixes PR20639.
llvm-svn: 215618
diff --git a/clang/test/SemaCXX/pragma-init_seg.cpp b/clang/test/SemaCXX/pragma-init_seg.cpp
index 38520b0..e18d0e6 100644
--- a/clang/test/SemaCXX/pragma-init_seg.cpp
+++ b/clang/test/SemaCXX/pragma-init_seg.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-pc-win32
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple i386-apple-darwin13.3.0
+#ifndef __APPLE__
#pragma init_seg(L".my_seg") // expected-warning {{expected 'compiler', 'lib', 'user', or a string literal}}
#pragma init_seg( // expected-warning {{expected 'compiler', 'lib', 'user', or a string literal}}
#pragma init_seg asdf // expected-warning {{missing '('}}
@@ -10,6 +12,10 @@
#pragma init_seg("\x") // expected-error {{\x used with no following hex digits}}
#pragma init_seg("a" L"b") // expected-warning {{expected non-wide string literal in '#pragma init_seg'}}
-int f();
#pragma init_seg(compiler)
+#else
+#pragma init_seg(compiler) // expected-warning {{'#pragma init_seg' is only supported when targeting a Microsoft environment}}
+#endif
+
+int f();
int __declspec(thread) x = f(); // expected-error {{initializer for thread-local variable must be a constant expression}}