xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/attr-section.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify -fsyntax-only -triple x86_64-apple-darwin9 %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc int x __attribute__((section(
4f4a2713aSLionel Sambuc    42)));  // expected-error {{'section' attribute requires a string}}
5f4a2713aSLionel Sambuc 
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc // rdar://4341926
8f4a2713aSLionel Sambuc int y __attribute__((section(
9f4a2713aSLionel Sambuc    "sadf"))); // expected-error {{mach-o section specifier requires a segment and section separated by a comma}}
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc // PR6007
test()12f4a2713aSLionel Sambuc void test() {
13*0a6a1f1dSLionel Sambuc   __attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions and global variables}}
14f4a2713aSLionel Sambuc   __attribute__((section("NEAR,x"))) static int n2; // ok.
15f4a2713aSLionel Sambuc }
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc // pr9356
18f4a2713aSLionel Sambuc void __attribute__((section("foo,zed"))) test2(void); // expected-note {{previous attribute is here}}
test2(void)19f4a2713aSLionel Sambuc void __attribute__((section("bar,zed"))) test2(void) {} // expected-warning {{section does not match previous declaration}}
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions and global variables}}
22