74 lines · c
1// RUN: %clang_cc1 -triple x86_64-pc-linux -Wno-strict-prototypes -verify -emit-llvm-only %s2 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// expected-note@-1 {{must refer to its mangled name}}9 10void f3(void) __attribute__((alias("g3"))); // expected-error {{alias must point to a defined variable or function}}11// expected-note@-1 {{must refer to its mangled name}}12void g3(void);13 14 15void f4() __attribute__((alias("g4")));16void g4() {}17void h4() __attribute__((alias("f4")));18 19void f5() __attribute__((alias("g5")));20void h5() __attribute__((alias("f5")));21void g5() {}22 23void g6() {}24void f6() __attribute__((alias("g6")));25void h6() __attribute__((alias("f6")));26 27void g7() {}28void h7() __attribute__((alias("f7")));29void f7() __attribute__((alias("g7")));30 31void h8() __attribute__((alias("f8")));32void g8() {}33void f8() __attribute__((alias("g8")));34 35void h9() __attribute__((alias("f9")));36void f9() __attribute__((alias("g9")));37void g9() {}38 39void f10() __attribute__((alias("g10"))); // expected-error {{alias definition is part of a cycle}}40void g10() __attribute__((alias("f10"))); // expected-error {{alias definition is part of a cycle}}41 42// FIXME: This could be a bit better, h10 is not part of the cycle, it points43// to it.44void h10() __attribute__((alias("g10"))); // expected-error {{alias definition is part of a cycle}}45 46extern int a1 __attribute__((alias("b1")));47int b1 = 42;48 49extern int a2 __attribute__((alias("b2"))); // expected-error {{alias must point to a defined variable or function}}50// expected-note@-1 {{must refer to its mangled name}}51 52extern int a3 __attribute__((alias("b3"))); // expected-error {{alias must point to a defined variable or function}}53// expected-note@-1 {{must refer to its mangled name}}54extern int b3;55 56extern int a4 __attribute__((alias("b4"))); // expected-error {{alias must point to a defined variable or function}}57// expected-note@-1 {{must refer to its mangled name}}58typedef int b4;59 60void test2_bar() {}61void test2_foo() __attribute__((weak, alias("test2_bar")));62void test2_zed() __attribute__((alias("test2_foo"))); // expected-warning {{alias will always resolve to test2_bar even if weak definition of test2_foo is overridden}}63 64void test3_bar() { }65void test3_foo() __attribute__((section("test"))); // expected-warning {{alias will not be in section 'test' but in the same section as the aliasee}}66void test3_foo() __attribute__((alias("test3_bar")));67 68__attribute__((section("test"))) void test4_bar() { }69void test4_foo() __attribute__((section("test")));70void test4_foo() __attribute__((alias("test4_bar")));71 72int test5_bar = 0;73extern struct incomplete_type test5_foo __attribute__((alias("test5_bar")));74