[cfe-dev] naked attribute

Reed Kotler rkotler at mips.com
Thu May 2 13:44:44 PDT 2013

I propose to make the following change to clang.

In the presence of the "naked" attribute, in cases where clang would 
normally implicitly emit a "return" instruction, it should emit an 
"unreachable" instruction.

If someone explicitly puts a C/C++ "return" statement in the code, clang 
should do what it normally does.

The semantics of the "naked" attribute forbid the compiler from emitting 
a (implicit) return statement, prologue and epilogue code. The 
presumption is that there is only inline assembly in such a function but 
that is not a requirement but the programmer must know what he/she is 
doing and realize the rest of the above.

If this reasonable I'll file a clang bug and  maybe fix it myself if 
it's obvious where to do this.

More information about the cfe-dev mailing list