2014-09-05 06:16:40 +08:00
|
|
|
// RUN: %clang_cc1 %s -verify -fsyntax-only -triple i686-pc-linux
|
2010-09-30 02:20:25 +08:00
|
|
|
|
2011-01-25 11:51:08 +08:00
|
|
|
int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}}
|
2010-09-30 02:20:25 +08:00
|
|
|
|
2013-07-24 03:30:11 +08:00
|
|
|
__attribute__((naked)) int t0(void) {
|
2011-07-11 23:24:01 +08:00
|
|
|
__asm__ volatile("mov r0, #0");
|
|
|
|
}
|
|
|
|
|
2010-09-30 02:20:25 +08:00
|
|
|
void t1() __attribute__((naked));
|
|
|
|
|
2013-07-24 03:30:11 +08:00
|
|
|
void t2() __attribute__((naked(2))); // expected-error {{'naked' attribute takes no arguments}}
|
2010-09-30 02:20:25 +08:00
|
|
|
|
2014-09-05 06:16:40 +08:00
|
|
|
__attribute__((naked)) int t3() { // expected-note{{attribute is here}}
|
|
|
|
return 42; // expected-error{{non-ASM statement in naked function is not supported}}
|
|
|
|
}
|
|
|
|
|
|
|
|
__attribute__((naked)) int t4() {
|
|
|
|
asm("movl $42, %eax");
|
|
|
|
asm("retl");
|
|
|
|
}
|