1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -verify -fsyntax-only -triple x86_64-apple-darwin9 %s
2797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner
3797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerint x __attribute__((section(
43cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman   42)));  // expected-error {{'section' attribute requires a string}}
5797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner
6797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner
7797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner// rdar://4341926
8797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerint y __attribute__((section(
9797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner   "sadf"))); // expected-error {{mach-o section specifier requires a segment and section separated by a comma}}
10797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner
11a1e1dc77e995b746826b64752751dbf35f323767Chris Lattner// PR6007
12a1e1dc77e995b746826b64752751dbf35f323767Chris Lattnervoid test() {
13651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  __attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions and global variables}}
14a1e1dc77e995b746826b64752751dbf35f323767Chris Lattner  __attribute__((section("NEAR,x"))) static int n2; // ok.
1583e7a78a9fa3fc495a575bca0e3d4d7ce26184efChris Lattner}
16420efd83934ee78f04d73880e2ed1b7fdef3328cRafael Espindola
17420efd83934ee78f04d73880e2ed1b7fdef3328cRafael Espindola// pr9356
18420efd83934ee78f04d73880e2ed1b7fdef3328cRafael Espindolavoid __attribute__((section("foo,zed"))) test2(void); // expected-note {{previous attribute is here}}
19420efd83934ee78f04d73880e2ed1b7fdef3328cRafael Espindolavoid __attribute__((section("bar,zed"))) test2(void) {} // expected-warning {{section does not match previous declaration}}
20651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
21651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesenum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions and global variables}}
22