1 // RUN: %clang_cc1 %s -verify -fsyntax-only -triple i686-pc-linux
3 int a
__attribute__((naked
)); // expected-warning {{'naked' attribute only applies to functions}}
5 __attribute__((naked
)) int t0(void) {
6 __asm__
volatile("mov r0, #0");
9 void t1(void) __attribute__((naked
));
11 void t2(void) __attribute__((naked(2))); // expected-error {{'naked' attribute takes no arguments}}
13 __attribute__((naked
)) int t3(void) { // expected-note{{attribute is here}}
14 return 42; // expected-error{{non-ASM statement in naked function is not supported}}
17 __attribute__((naked
)) int t4(void) {
18 asm("movl $42, %eax");
22 __attribute__((naked
)) int t5(int x
) {
27 __attribute__((naked
)) void t6(void) {
31 __attribute__((naked
)) void t7(void) {
32 asm("movl $42, %eax");
38 __attribute__((naked
)) void t8(int z
) { // expected-note{{attribute is here}}
39 __asm__ ("movl $42, %1"
41 "=r"(z
) // expected-error{{parameter references not allowed in naked functions}}
45 __attribute__((naked
)) void t9(int z
) { // expected-note{{attribute is here}}
46 __asm__ ("movl %eax, %1"
48 "r"(z
) // expected-error{{parameter references not allowed in naked functions}}
52 __attribute__((naked
)) void t10(void) { // expected-note{{attribute is here}}
53 int a
; // expected-error{{non-ASM statement in naked function is not supported}}
56 __attribute__((naked
)) void t11(void) { // expected-note{{attribute is here}}
57 register int a
asm("eax") = x
; // expected-error{{non-ASM statement in naked function is not supported}}
60 __attribute__((naked
)) void t12(void) { // expected-note{{attribute is here}}
61 register int a
asm("eax"), b
asm("ebx") = x
; // expected-error{{non-ASM statement in naked function is not supported}}
64 __attribute__((naked
)) void t13(void) {
65 register int a
asm("eax");
66 register int b
asm("ebx"), c
asm("ecx");