From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17163 invoked by alias); 17 Feb 2015 21:43:50 -0000 Mailing-List: contact cygwin-developers-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com Received: (qmail 17152 invoked by uid 89); 17 Feb 2015 21:43:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Feb 2015 21:43:49 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id CD365A80BEF; Tue, 17 Feb 2015 22:43:46 +0100 (CET) Date: Tue, 17 Feb 2015 21:43:00 -0000 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: A small issue with _GNU_SOURCE Message-ID: <20150217214346.GE8493@calimero.vinschen.de> Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <54E3808B.9040302@dronecode.org.uk> <54E38776.1030707@dronecode.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ufMBWnG1WFkAvCRz" Content-Disposition: inline In-Reply-To: <54E38776.1030707@dronecode.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-02/txt/msg00001.txt.bz2 --ufMBWnG1WFkAvCRz Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1804 On Feb 17 18:24, Jon TURNEY wrote: >=20 > Consider the following: >=20 > $ cat test.c > #include > #include >=20 > int main() > { > long long i =3D random(); > return ffsll(i); > } >=20 > ffsll() is a GNU extension and should be prototyped when _GNU_SOURCE is > defined. >=20 > random() is in SUSv2 and requires _XOPEN_SOURCE=3D500 >=20 > $ gcc test.c -Wall -ansi -D_XOPEN_SOURCE=3D700 > test.c: In function =E2=80=98main=E2=80=99: > test.c:8:2: warning: implicit declaration of function =E2=80=98ffsll=E2= =80=99 >=20 > This is correct >=20 > $ gcc test.c -Wall -ansi -D_XOPEN_SOURCE=3D700 -D_GNU_SOURCE > test.c: In function =E2=80=98main=E2=80=99: > test.c:8:2: warning: implicit declaration of function =E2=80=98ffsll=E2= =80=99 >=20 > This looks like a problem with newlib's sys/cdefs.h. _XOPEN_SOURCE causes > _POSIX_C_SOURCE to be defined, which prevents _GNU_SOURCE from being > considered. >=20 > $ gcc test.c -Wall -ansi -D_GNU_SOURCE > test.c: In function =E2=80=98main=E2=80=99: > test.c:7:2: warning: implicit declaration of function =E2=80=98random=E2= =80=99 >=20 > _GNU_SOURCE is supposed to imply some value of _XOPEN_SOURCE, but only > actually turns on __XSI_VISIBLE. >=20 > The patch I wrote for cygwin's stdlib.h [1] explicitly checks _XOPEN_SOUR= CE. > Should this be a check for XSI_VISIBLE? or should cdefs.h also define > _XOPEN_SOURCE (and all the other feature test macros that _GNU_SOURCE is > defined to be equivalent to)? The check should be one for XSI_VISIBLE. I'm not sure about cdefs.h, though. Maybe you want to ask the question on the newlib ML? I'll look into it tomorrow. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --ufMBWnG1WFkAvCRz Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU47YSAAoJEPU2Bp2uRE+gQHIP/RNZBiAdtMZN+smTasEeru7i iVTjhz8INBxxxrZEN6F0OEj9KuM298snpAAzfWuogp+FrnS+NG1bG3WBTnm83PKj WYSk9uinM1mKrhqXVWMgHt/9oW/2zTHzvC8vTr7GULhzcCAQwotUAJOrw+2tcqxD ZcsTZLJLZ+tqwwHXJSlM5j8dlSASEqo1gTDdy3adTD3TxLUXseugzXNlBlhfMKwE xFLg0AJcSp0ADaZaFd1eGfOVf3fshu/XZQYSlKa+2+subIkxvLPhojRpVxoz2Q+o A/Npfy4kdfGQOHx2u4SA4nRobtJzUIWar99mB01LXY6TgxdyE9eNHrpE5rls1bej X/gMJhTyl7gHr75OEOFkB97jk83aT52hwsEuLU/WYo9lPd376njKmb5LVALhRzqM VWxe1YV+mmqjFFVk5Er+3iFr0c/HJwt2kt30ZJ8nTvsX6GuI6mifXQ3nte4PvStd hg+RbyYnlEvW9qMaFQmRxLRPMcPl0Nz4D/iH5WeiaIti1gFNjs2A5v33wXA3ssIC jwy1uQonQ26SYTBRmBDPs05HtKoDD/n1MTtg+5iUsW66w2XmHjaYNanPfMrBqYFY B3LF9UB57V97VhOFMCtIqxAUIVtgVYozWiTSTQ7LJ1MG9CZlRUOL7Wxe8piWHuKl dBAJy0FJgatJUmCXlpgp =aVO5 -----END PGP SIGNATURE----- --ufMBWnG1WFkAvCRz--