1// RUN: %clang_cc1 %s -verify -fsyntax-only -triple i686-pc-linux 2 3int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}} 4 5__attribute__((naked)) int t0(void) { 6 __asm__ volatile("mov r0, #0"); 7} 8 9void t1() __attribute__((naked)); 10 11void t2() __attribute__((naked(2))); // expected-error {{'naked' attribute takes no arguments}} 12 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 17__attribute__((naked)) int t4() { 18 asm("movl $42, %eax"); 19 asm("retl"); 20} 21 22__attribute__((naked)) int t5(int x) { 23 asm("movl x, %eax"); 24 asm("retl"); 25} 26 27__attribute__((naked)) void t6() { 28 ; 29} 30 31__attribute__((naked)) void t7() { 32 asm("movl $42, %eax"); 33 ; 34} 35 36extern int x, y; 37 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 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