blob: 812de067180cb2555a14044a7ebbdfb05fa4615a [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -verify -fsyntax-only -triple x86_64-apple-darwin9 %s
Chris Lattner30ba6742009-08-10 19:03:04 +00002
3int x __attribute__((section(
Aaron Ballman3bf758c2013-07-30 01:31:03 +00004 42))); // expected-error {{'section' attribute requires a string}}
Chris Lattner30ba6742009-08-10 19:03:04 +00005
6
7// rdar://4341926
8int y __attribute__((section(
9 "sadf"))); // expected-error {{mach-o section specifier requires a segment and section separated by a comma}}
10
Chris Lattner20aee9b2010-01-12 20:58:53 +000011// PR6007
12void test() {
Aaron Ballman75a1729c2013-12-12 01:34:39 +000013 __attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute only applies to functions and global variables}}
Chris Lattner20aee9b2010-01-12 20:58:53 +000014 __attribute__((section("NEAR,x"))) static int n2; // ok.
Chris Lattner4b73cfa2010-04-07 22:58:06 +000015}
Rafael Espindola9869c3a2012-05-13 02:42:42 +000016
17// pr9356
18void __attribute__((section("foo,zed"))) test2(void); // expected-note {{previous attribute is here}}
19void __attribute__((section("bar,zed"))) test2(void) {} // expected-warning {{section does not match previous declaration}}
Aaron Ballman75a1729c2013-12-12 01:34:39 +000020
21enum __attribute__((section("NEAR,x"))) e { one }; // expected-error {{'section' attribute only applies to functions and global variables}}