This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to add new target macro: TARGET_WARN_RETURN_TYPE



  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]