delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/12/15/04:30:59

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=PDku0q9GrPt2zC9/MKbDJ9igAADUddI03Rj2hEs+J9q8WJ7mRFk/c
aATJz0xMbiEwoWBcGQP8oQqlhoOns08F1ofSiCDctZAc0Yr9+IiYHSkRPGDjuqxx
EBKSKD2Xv0DWmT/XguxZof4An4JQxOw2utPOZcFgV8o7g8YYmNYgnY=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=vTBu1mNs0UmopcivAgAurGNCp+E=; b=ap1T56DDMCyk1G3NA6Vwi4fBGpYa
NPSg+oNMGPbGALzT4BmHKCZfT6RIWz3LDbKczJyraIvRFzLUlOfmbHA/gnOe/g7M
cT6JUMYH5i47gvtwqb/QRaQbK0YRlAo1VaKWmW/XQpKyXSXFGdzne8O2wDDhgDmY
6fLGZ1Iu7sRTFO8=
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=3.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 15 Dec 2015 10:30:20 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: __STRICT_ANSI__ and stdio.h
Message-ID: <20151215093020.GA12827@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAPYQg31yUkpu9oC1cfWTmxaBANBYcd4X18RY9Q+BVpx-o=nLBw AT mail DOT gmail DOT com> <20151214140649 DOT GB29983 AT calimero DOT vinschen DOT de> <CAPYQg33AHw4k9hU8kXbsM9WJ3-+9gr5cm1Ob1S7YXO8MP3LGdQ AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAPYQg33AHw4k9hU8kXbsM9WJ3-+9gr5cm1Ob1S7YXO8MP3LGdQ@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)

--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Dec 15 02:17, KIMURA Masaru wrote:
> Hi,
>=20
> >> is cygwin's __STRICT_ANSI__ and stdio.h behavior not so compatible to =
glibc's?
> >
> > Cygwin is using newlib, newlib is BSD based.  We introduced the
> > compatibility checking macros from FreeBSD lately.
>=20
> i roughly checked FreeBSD include/stdio.h and sys/sys/cdefs.h.
> https://github.com/freebsd/freebsd/blob/master/include/stdio.h
> https://github.com/freebsd/freebsd/blob/master/sys/sys/cdefs.h
>=20
> it looks very different to newlib's.

Yes, it does.  Newlib has a long history diverging from the BSDs to
support embedded systems in the first place, and compatibility checking
macros other than __STRICT_ANSI__ and __POSIX_SOURCE weren't much of a
concern for a long time.

> FreeBSD has visibility for popen()/pclose() if __POSIX_VISIBLE >=3D 19920=
9,
> it looks no checking about __STRICT_ANSI__ in their cdefs.h.

Yeah, that's history as described above.  popen gets declared in newlib
if __STRICT_ANSI__ is not defined right now.

> only one thing i worried about is _ANSI_SOURCE in their cdefs.h,
> (b/c i don't understand where _ANSI_SOURCE comes from...)
> but it looks _POSIX_C_SOURCE wins anyway.
> for ease to see, i'd attach simplified their cdefs.h for their
> visibility handling.

I don't see the difference, see below.  The big differences in newlib
are the additional handling of _GNU_SOURCE and the old usage of
__STRICT_ANSI__ in some circumstances which haven't been replaced by another
usage of compatibility macros yet.

But here's the deal:  Newlib is a volunteer-driven project.  If the
compatiblity checking macros are not correct or not correctly used in
all circumstances, newlib is happily open to patches.  Just send them
to the newlib AT sourceware DOT org mailing list.

> #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE =3D=3D 1
>  #undef _POSIX_C_SOURCE
>  #define _POSIX_C_SOURCE 199009
> #endif

Same in Newlib's sys/cdefs.h.

> #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE =3D=3D 2
>  #undef _POSIX_C_SOURCE
>  #define _POSIX_C_SOURCE 199209
> #endif

Ditto.

> #ifdef _XOPEN_SOURCE
>  #if _XOPEN_SOURCE - 0 >=3D 700
>   #define __XSI_VISIBLE 700
>   #undef _POSIX_C_SOURCE
>   #define _POSIX_C_SOURCE 200809
>  #elif _XOPEN_SOURCE - 0 >=3D 600
>   #define __XSI_VISIBLE 600
>   #undef _POSIX_C_SOURCE
>   #define _POSIX_C_SOURCE 200112
>  #elif _XOPEN_SOURCE - 0 >=3D 500
>   #define __XSI_VISIBLE 500
>   #undef _POSIX_C_SOURCE
>   #define _POSIX_C_SOURCE 199506
>  #endif
> #endif

Ditto.

> #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
>  #define _POSIX_C_SOURCE 198808
> #endif

Ditto.

> #ifdef _POSIX_C_SOURCE
>  #if _POSIX_C_SOURCE >=3D 200809
>   #define __POSIX_VISIBLE 200809
>   #define __ISO_C_VISIBLE 1999
>  #elif _POSIX_C_SOURCE >=3D 200112
>   #define __POSIX_VISIBLE 200112
>   #define __ISO_C_VISIBLE 1999
>  #elif _POSIX_C_SOURCE >=3D 199506
>   #define __POSIX_VISIBLE 199506
>   #define __ISO_C_VISIBLE 1990
>  #elif _POSIX_C_SOURCE >=3D 199309
>   #define __POSIX_VISIBLE 199309
>   #define __ISO_C_VISIBLE 1990
>  #elif _POSIX_C_SOURCE >=3D 199209
>   #define __POSIX_VISIBLE 199209
>   #define __ISO_C_VISIBLE 1990
>  #elif _POSIX_C_SOURCE >=3D 199009
>   #define __POSIX_VISIBLE 199009
>   #define __ISO_C_VISIBLE 1990
>  #else
>   #define __POSIX_VISIBLE 198808
>   #define __ISO_C_VISIBLE 0
>  #endif
> #else
>  #if defined(_ANSI_SOURCE)
>   #define __POSIX_VISIBLE 0
>   #define __XSI_VISIBLE 0
>   #define __BSD_VISIBLE 0
>   #define __ISO_C_VISIBLE 1990
>  #elif defined(_C99_SOURCE)
>   #define __POSIX_VISIBLE 0
>   #define __XSI_VISIBLE 0
>   #define __BSD_VISIBLE 0
>   #define __ISO_C_VISIBLE 1999
>  #elif defined(_C11_SOURCE)
>   #define __POSIX_VISIBLE 0
>   #define __XSI_VISIBLE 0
>   #define __BSD_VISIBLE 0
>   #define __ISO_C_VISIBLE 2011
>  #else
>   #define __POSIX_VISIBLE 200809
>   #define __XSI_VISIBLE 700
>   #define __BSD_VISIBLE 1
>   #define __ISO_C_VISIBLE 2011
>  #endif
> #endif

Ditto.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--zhXaljGHf11kAtnf
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWb92sAAoJEPU2Bp2uRE+gLhMQAIppp5eYFt2ZVFF48BUDewdF
gRIIVO1/NK8LludSYqhhErchAW3zM9Iq8sT88vAK07ApQfioYksrFBkGm+dzJWcX
viY8PH9YzkIsxAaI1iVwkFR0JNLEBdpSdqFPilCek0p0NHAMw46XBXl/+zA9KVVv
Hj4SKfTHXJo2RvctNBpUb9FgVKQAb4oXOf/1JNRMFUM6Lq1hUMAlUsz8ux+vnXXO
N+2Y1EM3esfMwH751LrU6lSk+a+qNihmb6K+umRPgXh0IbeY5+qe40RRWJEqwTIp
iGgqeSJWn5ZYhXTXbD6RG9MhCDFSFEhk+P2Gtfg6CU/wRIZCmcUyXr8hUZWYgGYN
uUSW2PNbJzsVhIHtJjyPnspDmVzT4u7L//uOx5ZUpwKQmuOvCjjYl1YSZDp9zOsD
GIwMCTOvc+X2+H9Uo2QW/745yEkkrENATLmlH6rciqt6/Tdfr0jJj9tK3zTDyK41
8oiBq/Gh1zrixrS2paeYYGxUa1qTIj3HJghL46Y/lyaKY8+T3rjDRmkYqx66j17z
2k+yUnDkMhegz/GvRVr0TkqXItXOuJpB/+9RI/bSblbES2Qqw9APRDw6sJROrAe8
Ia5uSPTayfZrwgWVfFX6Ss7p3DjhExR8ZBxiPUTfExGLFEmqWpR54RJxDblEjG1p
n1evW6NtxIlQxFDHgukT
=lDhu
-----END PGP SIGNATURE-----

--zhXaljGHf11kAtnf--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019