This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: allowing redefinition of setjmp()?
- From: "Schwarz, Konrad" <konrad dot schwarz at siemens dot com>
- To: Eric Blake <eblake at redhat dot com>, The Cygwin Mailing List <cygwin at cygwin dot com>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Mon, 26 Jan 2015 10:19:28 +0000
- Subject: RE: allowing redefinition of setjmp()?
- Authentication-results: sourceware.org; auth=none
- References: <54C2C68E dot 5090100 at redhat dot com>
> -----Original Message-----
> To: The Cygwin Mailing List; newlib@sourceware.org
> Subject: allowing redefinition of setjmp()?
> Reading POSIX, I see that Cygwin is compliant, and readline is at
> fault.
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/setjmp.html
> 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().