blob: 82ab07678261726f87e8cc5de81023d172177ef6 [file] [log] [blame]
Rafael Espindolad2054982013-10-22 19:26:13 +00001// RUN: %clang_cc1 -triple x86_64-pc-linux -fsyntax-only -verify -emit-llvm-only %s
2
3void f1(void) __attribute__((alias("g1")));
4void g1(void) {
5}
6
7void f2(void) __attribute__((alias("g2"))); // expected-error {{alias must point to a defined variable or function}}
8
9
10void f3(void) __attribute__((alias("g3"))); // expected-error {{alias must point to a defined variable or function}}
11void g3(void);
12
13
14void f4() __attribute__((alias("g4")));
15void g4() {}
16void h4() __attribute__((alias("f4")));
17
18void f5() __attribute__((alias("g5")));
19void h5() __attribute__((alias("f5")));
20void g5() {}
21
22void g6() {}
23void f6() __attribute__((alias("g6")));
24void h6() __attribute__((alias("f6")));
25
26void g7() {}
27void h7() __attribute__((alias("f7")));
28void f7() __attribute__((alias("g7")));
29
30void h8() __attribute__((alias("f8")));
31void g8() {}
32void f8() __attribute__((alias("g8")));
33
34void h9() __attribute__((alias("f9")));
35void f9() __attribute__((alias("g9")));
36void g9() {}
37
Rafael Espindolad2054982013-10-22 19:26:13 +000038extern int a1 __attribute__((alias("b1")));
39int b1 = 42;
40
41extern int a2 __attribute__((alias("b2"))); // expected-error {{alias must point to a defined variable or function}}
42
43extern int a3 __attribute__((alias("b3"))); // expected-error {{alias must point to a defined variable or function}}
44extern int b3;
45
46extern int a4 __attribute__((alias("b4"))); // expected-error {{alias must point to a defined variable or function}}
47typedef int b4;
Stephen Hines651f13c2014-04-23 16:59:28 -070048
49void test2_bar() {}
50void test2_foo() __attribute__((weak, alias("test2_bar")));
51void test2_zed() __attribute__((alias("test2_foo"))); // expected-warning {{alias will always resolve to test2_bar even if weak definition of alias test2_foo is overridden}}
Stephen Hines6bcf27b2014-05-29 04:14:42 -070052
53void test3_bar() { }
54void test3_foo() __attribute__((section("test"))); // expected-warning {{alias will not be in section 'test' but in the same section as the aliasee}}
55void test3_foo() __attribute__((alias("test3_bar")));
56
57__attribute__((section("test"))) void test4_bar() { }
58void test4_foo() __attribute__((section("test")));
59void test4_foo() __attribute__((alias("test4_bar")));