xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/pragma-init_seg.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-pc-win32
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple i386-apple-darwin13.3.0
3*0a6a1f1dSLionel Sambuc 
4*0a6a1f1dSLionel Sambuc #ifndef __APPLE__
5*0a6a1f1dSLionel Sambuc #pragma init_seg(L".my_seg") // expected-warning {{expected 'compiler', 'lib', 'user', or a string literal}}
6*0a6a1f1dSLionel Sambuc #pragma init_seg( // expected-warning {{expected 'compiler', 'lib', 'user', or a string literal}}
7*0a6a1f1dSLionel Sambuc #pragma init_seg asdf // expected-warning {{missing '('}}
8*0a6a1f1dSLionel Sambuc #pragma init_seg) // expected-warning {{missing '('}}
9*0a6a1f1dSLionel Sambuc #pragma init_seg("a" "b") // no warning
10*0a6a1f1dSLionel Sambuc #pragma init_seg("a", "b") // expected-warning {{missing ')'}}
11*0a6a1f1dSLionel Sambuc #pragma init_seg("a") asdf // expected-warning {{extra tokens at end of '#pragma init_seg'}}
12*0a6a1f1dSLionel Sambuc #pragma init_seg("\x") // expected-error {{\x used with no following hex digits}}
13*0a6a1f1dSLionel Sambuc #pragma init_seg("a" L"b") // expected-warning {{expected non-wide string literal in '#pragma init_seg'}}
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc #pragma init_seg(compiler)
16*0a6a1f1dSLionel Sambuc #else
17*0a6a1f1dSLionel Sambuc #pragma init_seg(compiler) // expected-warning {{'#pragma init_seg' is only supported when targeting a Microsoft environment}}
18*0a6a1f1dSLionel Sambuc #endif
19*0a6a1f1dSLionel Sambuc 
20*0a6a1f1dSLionel Sambuc int f();
21*0a6a1f1dSLionel Sambuc int __declspec(thread) x = f(); // expected-error {{initializer for thread-local variable must be a constant expression}}
22