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