This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH v1 1/3] Feature test macro overhaul
- From: Yaakov Selkowitz <yselkowitz at cygwin dot com>
- To: newlib at sourceware dot org
- Date: Fri, 12 Feb 2016 12:07:58 -0600
- Subject: Re: [PATCH v1 1/3] Feature test macro overhaul
- Authentication-results: sourceware.org; auth=none
- References: <56BD7A33 dot 3030501 at cygwin dot com> <1903668383 dot 88367 dot 1455260361008 dot JavaMail dot zimbra at embedded-brains dot de> <20160212145823 dot GC5615 at calimero dot vinschen dot de>
On 2016-02-12 08:58, Corinna Vinschen wrote:
On Feb 12 07:59, Sebastian Huber wrote:
its good that you keep the FreeBSD __*_VISIBLE defines in place, so
that its still easy to use code from FreeBSD. At least for RTEMS this
is important, since we use the network, USB and SD/MMC stack from
I am not sure if its a good thing to do the feature checks differently
in each C library. My approach would have been to us an existing
mechanism and in case of errors report them to the upstream.
I'm also a bit concerned here. It decouples us partially from upstream.
The changes don't look bad, mind, but it now looks a bit like a mix
between Glibc and FreeBSD. Can we maintain this easily in future?
Having built thousands of packages for Cygwin, I can attest that our
feature test macros are lacking in several ways:
* combining -ansi/-std=c* -D_*_SOURCE doesn't always work as expected;
* several _*_SOURCE switches aren't recognized;
* some symbols don't have the proper guards.
Obviously, this is modeled after glibc's feature test macros documentation:
with some changes found upon testing, while maintaining the __*_VISIBLE
nomenclature already present instead of the __USE_* mentioned therein.
WRT style, I thought that being able to use #if instead of #ifdef (or
even #if defined() || defined() etc.) would be more readable,
particularly when a symbol can be switched on my multiple guards.
Similarly, e.g. __POSIX2001_VISIBLE would be easier to read than
__POSIX_VISIBLE >= 200112L, particularly in the cases where things were
in previous versions of POSIX.1 but removed in later versions.
WRT compatibility with FreeBSD, the only issue would be if entire
headers are copied therefrom. However, there are certainly some
FreeBSD-isms have to anyways be tweaked when doing so; I don't see how
this is any different.