This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __STRICT_ANSI__ and stdio.h


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.
>
> [SNIP]

ah, i didn't check newlib's sys/cdefs.h.
thank you for correcting my misunderstanding.

apart from standard compliance correctness,
it's good to hear newlib can deal it.
if i had more spare time to dive its source, i'd like to do it.

Peace,

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]