1 // RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s
3 #pragma alloc_text() // expected-warning {{expected a string literal for the section name in '#pragma alloc_text'}}
4 #pragma alloc_text(a // expected-warning {{expected ',' in '#pragma alloc_text'}}
5 #pragma alloc_text(a, a // expected-warning {{missing ')' after '#pragma alloc_text'}}
6 #pragma alloc_text(a, a) // expected-error {{use of undeclared a}}
7 #pragma alloc_text(L"a", a) // expected-warning {{expected a string literal for the section name}}
10 #pragma alloc_text(a, foo) // expected-error {{'#pragma alloc_text' is applicable only to functions with C linkage}}
12 extern "C" void foo1();
13 #pragma alloc_text(a, foo1) // no-warning
14 #pragma alloc_text(a, foo1) asdf // expected-warning {{extra tokens at end of '#pragma alloc_text'}}
15 #pragma alloc_text(a, foo1 // expected-warning {{missing ')' after '#pragma alloc_text'}}
18 #pragma alloc_text(b, foo1) // no-warning
23 #pragma alloc_text(a, foo2) // no-warning
27 #pragma alloc_text(a, foo1) // expected-error {{'#pragma alloc_text' can only appear at file scope}}
30 extern "C" void foo4();
31 #pragma alloc_text(c, foo4) // no-warning
34 void foo5(); // expected-note {{previous declaration is here}}
35 #pragma alloc_text(c, foo5) // expected-error {{'#pragma alloc_text' is applicable only to functions with C linkage}}
36 extern "C" void foo5() {} // expected-error {{declaration of 'foo5' has a different language linkage}}
40 #pragma alloc_text(c, foo6) // no-warning
48 #pragma alloc_text(c, foo7) // no-warning
55 #pragma alloc_text(c, foo8) // expected-error {{'#pragma alloc_text' is applicable only to functions with C linkage}}
58 enum foo9
{ A
, B
, C
};
59 #pragma alloc_text(c, foo9) // expected-error {{'#pragma alloc_text' is applicable only to functions}}