tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Special function names



On Sat, Oct 19, 2019 at 02:54:58AM +0200, Joerg Sonnenberger wrote:
> On Fri, Oct 18, 2019 at 05:30:13PM +0100, Robert Swindells wrote:
> > 
> > Joerg pointed out that gcc has a list of function names that it special
> > cases, this was the cause of x86/vm_machdep.c failing to compile:
> > 
> > <http://mail-index.netbsd.org/current-users/2019/10/17/msg036799.html>
> > 
> > Any thoughts on whether we should remove some or all of the names
> > from the list in our build of gcc ?
> > 
> > The list is: "setjmp", "sigsetjmp", "savectx", "vfork", "getcontext"
> > 
> > There are similar declarations in clang.
> 
> We had that discussion in the specific context of savectx in LLVM a long
> time ago. Consensus was that the chance of breaking code in bad ways is
> still high enough that it is just better to avoid the names in new code.

I'm pretty sure it is impossible to implement setjmp/longjmp without
the compiler knowing that is what you are doing.
It has to leave the stack in a 'reasonable' state for it to work.
So you may be allowed to call a function 'setjmp', but it hadn't
better be able to return twice.

This is much the same as it isn't possible to provide alloca()
as a library function.

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index