allowing redefinition of setjmp()?

Schwarz, Konrad
Mon Jan 26 21:31:00 GMT 2015

> -----Original Message-----
> To: The Cygwin Mailing List;
> Subject: allowing redefinition of setjmp()?
> Reading POSIX, I see that Cygwin is compliant, and readline is at
> fault.
> is clear:
> "It is unspecified whether setjmp() is a macro or a function. If a
> macro definition is suppressed in order to access an actual function,
> or a program defines an external identifier with the name setjmp, the
> behavior is undefined."

Honestly, this is what I expected.

> But as the redefine works in Linux, I'm wondering if we tweak things in
> Cygwin and/or newlib to allow it to work here too.  Maybe by making an
> entry point __setjmp() as an alias for setjmp(), and defining
> sigsetjmp() in terms of __setjmp(), so that when someone adds a #define
> wrapper for setjmp, it is no longer a mutually recursive macro naming
> scenario.

It this really worth it?

> In the meantime, I'm resorting to patching up readline code to quit
> trying to (re)define setjmp.

Stating the obvious, all you need to do is globally replace setjmp() with e.g. readline_setjmp().

More information about the Newlib mailing list