On Dec 15 02:17, KIMURA Masaru wrote: > Hi, > > >> 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. > > 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 > > 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 >= 199209, > 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 == 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 == 2 > #undef _POSIX_C_SOURCE > #define _POSIX_C_SOURCE 199209 > #endif Ditto. > #ifdef _XOPEN_SOURCE > #if _XOPEN_SOURCE - 0 >= 700 > #define __XSI_VISIBLE 700 > #undef _POSIX_C_SOURCE > #define _POSIX_C_SOURCE 200809 > #elif _XOPEN_SOURCE - 0 >= 600 > #define __XSI_VISIBLE 600 > #undef _POSIX_C_SOURCE > #define _POSIX_C_SOURCE 200112 > #elif _XOPEN_SOURCE - 0 >= 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 >= 200809 > #define __POSIX_VISIBLE 200809 > #define __ISO_C_VISIBLE 1999 > #elif _POSIX_C_SOURCE >= 200112 > #define __POSIX_VISIBLE 200112 > #define __ISO_C_VISIBLE 1999 > #elif _POSIX_C_SOURCE >= 199506 > #define __POSIX_VISIBLE 199506 > #define __ISO_C_VISIBLE 1990 > #elif _POSIX_C_SOURCE >= 199309 > #define __POSIX_VISIBLE 199309 > #define __ISO_C_VISIBLE 1990 > #elif _POSIX_C_SOURCE >= 199209 > #define __POSIX_VISIBLE 199209 > #define __ISO_C_VISIBLE 1990 > #elif _POSIX_C_SOURCE >= 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 -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgpb2g8eGrN7y.pgp
Description: PGP signature