1 // RUN: %clang_cc1 %s -verify -fsyntax-only -triple i686-pc-linux 2 3 int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}} 4 t0(void)5__attribute__((naked)) int t0(void) { 6 __asm__ volatile("mov r0, #0"); 7 } 8 9 void t1() __attribute__((naked)); 10 11 void t2() __attribute__((naked(2))); // expected-error {{'naked' attribute takes no arguments}} 12 t3()13__attribute__((naked)) int t3() { // expected-note{{attribute is here}} 14 return 42; // expected-error{{non-ASM statement in naked function is not supported}} 15 } 16 t4()17__attribute__((naked)) int t4() { 18 asm("movl $42, %eax"); 19 asm("retl"); 20 } 21 t5(int x)22__attribute__((naked)) int t5(int x) { 23 asm("movl x, %eax"); 24 asm("retl"); 25 } 26 t6()27__attribute__((naked)) void t6() { 28 ; 29 } 30 t7()31__attribute__((naked)) void t7() { 32 asm("movl $42, %eax"); 33 ; 34 } 35 36 extern int x, y; 37 t8(int z)38__attribute__((naked)) void t8(int z) { // expected-note{{attribute is here}} 39 __asm__ ("movl $42, %1" 40 : "=r"(x), 41 "=r"(z) // expected-error{{parameter references not allowed in naked functions}} 42 ); 43 } 44 t9(int z)45__attribute__((naked)) void t9(int z) { // expected-note{{attribute is here}} 46 __asm__ ("movl %eax, %1" 47 : : "r"(x), 48 "r"(z) // expected-error{{parameter references not allowed in naked functions}} 49 ); 50 } 51