[cfe-dev] naked attribute

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri May 10 06:33:38 PDT 2013


> I think we should only produce the unreachable in places where the compiler
> would implicitly insert a return.
>
> If the user actually has a "return" or "return xxx", we should honor that;
> however it's not clear
> what it would mean exactly.

This part is really odd on the gcc side: It sets up the return value,
but doesn't actually return. It is also documented that the only safe
thing to put in naked functions are inline asm statements, so I don't
worry too much about the other cases.

> If we don't intend to honor the explicit return, then we should print a
> warning and say what we are doing: i.e. turning it into unreachable, or
> ignoring it, or whatever it is that we are doing, or maybe make it an error
> to have an explicit return in a naked procedure.
>
> We discussed this earlier but I just wanted to bring it up again.

I would definitely welcome a warning on the lines of "only inline asms
are guaranteed to work on naked functions".

Cheers,
Rafael



More information about the cfe-dev mailing list