[cfe-dev] naked attribute

Tim Northover t.p.northover at gmail.com
Thu May 2 14:08:00 PDT 2013


Hi Reed,

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

I'd have loved to if we were designing the attribute from scratch; I
think the semantics would definitely be better. Unfortunately GCC got
there first, and at least on AArch64 it also puts the implicit return
in. I'll check AArch32 at work tomorrow.

If so, there's a real risk of breaking compatibility if anyone
actually uses naked functions already. Not a fatal barrier, but one we
should consider carefully.

Tim.



More information about the cfe-dev mailing list