The __naked
that I know of is
#define __naked __attribute__((naked))
Which is a GCC attribute that is documented here.
It is not supported on all targets. Doing a google code search will turn up some uses of it, though.
The reasons that it is done as a macro is so that it can be defined as empty for targets that don't support it or if the headers are being used with some other compiler.
I do remember (I think) seeing some examples of this for the division and modulation (divmod
) functions for avr_gcc headers. This returned a struct that had both return values in it, but stored the whole thing in registers rather than on the stack.
I don't know if __naked
had anything to do with the ability to return both parts of the result (which were in a struct) in registers (rather than on the stack), but it did allow the inline function to consist entirely of a call to one helper function.