[cfe-dev] naked attribute

Chris Lattner clattner at apple.com
Thu May 2 14:04:29 PDT 2013


On May 2, 2013, at 1:44 PM, Reed Kotler <rkotler at mips.com> wrote:

> 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.

This seems pretty reasonable to me.

-Chris

> 
> 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.
> 
> 
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list