| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:message-id:date:from:mime-version:to:subject | |
| :content-type; q=dns; s=default; b=P9zVrkebHKiCShTjl4zP7N8gU36Tl | |
| TbuIk5W4sZB2kdng7+yV/66XHXU00tqaOI1Qz26D0z4dhE4NyG4K8f338y8ljs9T | |
| 3VtGdR65aIlBVcrvupDSyjqBxm0iYrskthEwmcMMpom2SljYim0l9/h4zQGIByUe | |
| t+wSrwZ8/W9W4w= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:message-id:date:from:mime-version:to:subject | |
| :content-type; s=default; bh=yUNCceKQAYIjCZbcc8lsw2yUtkk=; b=Ymm | |
| zbq738AX9b6Iyvp7oBQabv/3yJqyeVCYZs+6Zt8m7az7BxwOExyyA2qoY6ucKAGa | |
| lv9C9StRDCRVy2hdDz5gUI70EH8UIVNjlEICYV26VBFX8A+eNV21Vv1OpeePHa+s | |
| xLhF7EUAr4Ed36PF9hZVa012huCvyD9BKVeIdp0I= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Spam-SWARE-Status: | No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 |
| X-Spam-User: | qpsmtpd, 2 recipients |
| X-HELO: | mx1.redhat.com |
| Message-ID: | <54C2C68E.5090100@redhat.com> |
| Date: | Fri, 23 Jan 2015 15:09:18 -0700 |
| From: | Eric Blake <eblake AT redhat DOT com> |
| User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
| MIME-Version: | 1.0 |
| To: | The Cygwin Mailing List <cygwin AT cygwin DOT com>, |
| "newlib AT sourceware DOT org" <newlib AT sourceware DOT org> | |
| Subject: | allowing redefinition of setjmp()? |
| OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
| X-IsSubscribed: | yes |
--45tufJGHLIHKAhcVhitgEA9h9Mn5CGixQ
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
I'm trying to build readline 6.3 for cygwin (in preparation for bash
4.3), but ran into a snag. Readline tries to redefine 'setjmp' in terms
of 'sigsetjmp' via a wrapper header (presumably faster to wrap the
problem away than auditing lots of old code to find where setjmp was
used?), which works on Linux but fails miserably on Cygwin:
...
#if defined (HAVE_POSIX_SIGSETJMP)
# define procenv_t sigjmp_buf
# if !defined (__OPENNT)
# undef setjmp
# define setjmp(x) sigsetjmp((x), 1)
...
$ printf '#include "config.h"
#include <setjmp.h>
#include "posixjmp.h"
sigsetjmp(a,0)\n' | gcc -E - | tail -n1
__extension__ ({ sigjump_buf *_sjbuf =3D &(a); ((*_sjbuf)[(13 * 4)] =3D 0,
pthread_sigmask (0, 0, (sigset_t *)((*_sjbuf) + ((13 * 4)+1))),
sigsetjmp (*_sjbuf)); })
Basically, because readline's causes two macros to be defined in terms
of each other, the expansion of sigsetjmp is trying to invoke a function
named sigsetjmp, but no such function exists on Cygwin, leading to this
compilation failure:
readline.c: In function 'readline_internal_char':
readline.c:541:7: error: implicit declaration of function 'sigsetjmp'
[-Werror=3Dimplicit-function-declaration]
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."
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.
In the meantime, I'm resorting to patching up readline code to quit
trying to (re)define setjmp.
--=20
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
--45tufJGHLIHKAhcVhitgEA9h9Mn5CGixQ
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBCAAGBQJUwsaOAAoJEKeha0olJ0Nq6YsIAKt2mk8/rQANgZ20rJjPmL1J
L8Q7bPBMZ20jqgdGF8Vlex9r9eIQzyYaFjUas34bGbLYPqtYQHkJ0SvJ5GzqT9ov
PXbq9JNbrPu5EbYm9Jrd1Oq3l1cs9R55+ZkwCmhWniVlBavpAfD7V3Qe4XQ2/Gmq
+hdYQsyQUFuvTZm5iVyqdKC4JB6ILI+MokxZUMXCQyEcaOc+aWFmGba+pY/527eD
gQD+nysj2rhQi0LTIVh2Who56EKC4Q5lS3q3JOji+H2Hw4C3mJhgnbqCT+p3/Btg
0HdmPXcESgdjhoxERGs4UqPZ72ZluERd9prsYfGiVehp/1m0Fp2Nk+/XQ1IYTH0=
=W0ey
-----END PGP SIGNATURE-----
--45tufJGHLIHKAhcVhitgEA9h9Mn5CGixQ--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |