This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: __STRICT_ANSI__ and stdio.h
- From: KIMURA Masaru <hiyuh dot root at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 15 Dec 2015 02:17:13 +0900
- Subject: Re: __STRICT_ANSI__ and stdio.h
- Authentication-results: sourceware.org; auth=none
- References: <CAPYQg31yUkpu9oC1cfWTmxaBANBYcd4X18RY9Q+BVpx-o=nLBw at mail dot gmail dot com> <20151214140649 dot GB29983 at calimero dot vinschen dot de>
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.
FreeBSD has visibility for popen()/pclose() if __POSIX_VISIBLE >= 199209,
it looks no checking about __STRICT_ANSI__ in their cdefs.h.
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.
anyway, IIUC, newlib's behavior in regard this point looks not
equivalent to FreeBSD's...
Peace,
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199009
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199209
#endif
#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
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 198808
#endif
#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
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple