Clang Project

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