This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to add new target macro: TARGET_WARN_RETURN_TYPE
- To: Nick Clifton <nickc at cygnus dot com>
- Subject: Re: Patch to add new target macro: TARGET_WARN_RETURN_TYPE
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 23 Mar 1999 22:05:07 -0700
- cc: egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199903231730.JAA02656@elmo.cygnus.com>you write:
> Is this necessary ? I thought you could do it using clobbered
> registers, eg:
>
> asm ("mov r0, #0" ::: "r0");
>
> (assuming that r0 is the return register).
Dangerous. Very dangerous. That's a clobber, not a set. The only
reason it works is this asm is implicitly volatile and happens to be the
last instruction. I *strongly* recommend against this kind of asm usage.
> The problem I was trying to solve was the case where naked functions
> are supported. In this case using a return statement is invalid,
> because the compiler is not allowed to generate the function's
> epilogue.
Right. I realize that.
> Doing this however seemed like too much feature add, especially since
> naked functions are not a generic feature, so I abandoned the idea.
> Of course if there is ever a real demand for this kind of thing in the
> future then these ideas can be ressurrected.
There's actually been many requests for a "naked" attribute over the years
to suppress prologue/epilogue generation.
jeff