Don't complain about missing return statements for naked

functions. Fixes <rdar://problem/9731999>.

llvm-svn: 134897
This commit is contained in:
Douglas Gregor 2011-07-11 15:24:01 +00:00
parent 1f2aacf276
commit 9824aec830
2 changed files with 8 additions and 0 deletions

View File

@ -6457,6 +6457,10 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
// Implements C++ [basic.start.main]p5 and C99 5.1.2.2.3.
FD->setHasImplicitReturnZero(true);
WP.disableCheckFallThrough();
} else if (FD->hasAttr<NakedAttr>()) {
// If the function is marked 'naked', don't complain about missing return
// statements.
WP.disableCheckFallThrough();
}
// MSVC permits the use of pure specifier (=0) on function definition,

View File

@ -2,6 +2,10 @@
int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}}
__attribute__((naked)) int t0(void) {
__asm__ volatile("mov r0, #0");
}
void t1() __attribute__((naked));
void t2() __attribute__((naked(2))); // expected-error {{attribute takes no arguments}}