xref: /aosp_15_r20/external/clang/test/Sema/asm-label.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li void f();
4*67e74705SXin Li void f() __asm__("fish");
5*67e74705SXin Li void g();
6*67e74705SXin Li 
f()7*67e74705SXin Li void f() {
8*67e74705SXin Li   g();
9*67e74705SXin Li }
10*67e74705SXin Li void g() __asm__("gold");  // expected-error{{cannot apply asm label to function after its first use}}
11*67e74705SXin Li 
12*67e74705SXin Li void h() __asm__("hose");  // expected-note{{previous declaration is here}}
13*67e74705SXin Li void h() __asm__("hair");  // expected-error{{conflicting asm label}}
14*67e74705SXin Li 
15*67e74705SXin Li int x;
16*67e74705SXin Li int x __asm__("xenon");
17*67e74705SXin Li int y;
18*67e74705SXin Li 
test()19*67e74705SXin Li int test() { return y; }
20*67e74705SXin Li 
21*67e74705SXin Li int y __asm__("yacht");  // expected-error{{cannot apply asm label to variable after its first use}}
22*67e74705SXin Li 
23*67e74705SXin Li int z __asm__("zebra");  // expected-note{{previous declaration is here}}
24*67e74705SXin Li int z __asm__("zooms");  // expected-error{{conflicting asm label}}
25*67e74705SXin Li 
26*67e74705SXin Li 
27*67e74705SXin Li // No diagnostics on the following.
28*67e74705SXin Li void __real_readlink() __asm("readlink");
29*67e74705SXin Li void readlink() __asm("__protected_readlink");
readlink()30*67e74705SXin Li void readlink() { __real_readlink(); }
31