public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: KIMURA Masaru <hiyuh.root@gmail.com>
To: cygwin@cygwin.com
Subject: Re: __STRICT_ANSI__ and stdio.h
Date: Mon, 14 Dec 2015 17:17:00 -0000	[thread overview]
Message-ID: <CAPYQg33AHw4k9hU8kXbsM9WJ3-+9gr5cm1Ob1S7YXO8MP3LGdQ@mail.gmail.com> (raw)
In-Reply-To: <20151214140649.GB29983@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

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,

[-- Attachment #2: cdefs.h --]
[-- Type: text/x-chdr, Size: 1960 bytes --]

#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

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
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

  reply	other threads:[~2015-12-14 17:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12  7:51 KIMURA Masaru
2015-12-13 16:51 ` cyg Simple
2015-12-14  4:56   ` KIMURA Masaru
2015-12-14  4:58     ` KIMURA Masaru
2015-12-14 13:34     ` cyg Simple
2015-12-14 14:06 ` Corinna Vinschen
2015-12-14 17:17   ` KIMURA Masaru [this message]
2015-12-15  9:30     ` Corinna Vinschen
2015-12-15 15:58       ` KIMURA Masaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPYQg33AHw4k9hU8kXbsM9WJ3-+9gr5cm1Ob1S7YXO8MP3LGdQ@mail.gmail.com \
    --to=hiyuh.root@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).