This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH v2 1/4] Feature test macro overhaul
- From: Yaakov Selkowitz <yselkowitz at cygwin dot com>
- To: newlib at sourceware dot org
- Date: Tue, 23 Feb 2016 20:33:47 -0600
- Subject: Re: [PATCH v2 1/4] Feature test macro overhaul
- Authentication-results: sourceware.org; auth=none
- References: <56CBD0E4 dot 4010106 at redhat dot com> <20160223182719 dot GB3432 at calimero dot vinschen dot de>
On 2016-02-23 12:27, Corinna Vinschen wrote:
+#if !defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE) && \
+ !defined(_ISOC99_SOURCE) && !defined(_POSIX_SOURCE) && \
+ !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && \
+ !defined(_BSD_SOURCE) && !defined(_SVID_SOURCE)
+#define _BSD_SOURCE
+#define _SVID_SOURCE
+#endif
Can you please explain this expression? Why is _BSD_SOURCE + _SVID_SOURCE
the default? Is that derived from some BSD default setting?
If neither __STRICT_ANSI__ nor any _*_SOURCE macros are defined, then
the default is, as you noted, BSD, SVID, and POSIX.1-2008, the latter of
which is turned on in the next chunk.
The question is a bit dumb perhaps. It's a result of me digging into
the Linux feature_test_macros man page which contains basically the
following information:
- _BSD_SOURCE is deprecated and has the same effect as _DEFAULT_SOURCE
- _SVID_SOURCE is deprecated and has the same effect as _DEFAULT_SOURCE
- _DEFAULT_SOURCE is effectively
_BSD_SOURCE | _SVID_SOURCE | _POSIX_C_SOURCE=200809
I had thought _DEFAULT_SOURCE was really new, but time flies. I'll look
into incorporating it into the next draft.
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809
+#undef _ATFILE_SOURCE
+#define _ATFILE_SOURCE
+#endif
Maybe better
#define _ATFILE_SOURCE 1
Fixed locally, and the same for the aforementioned BSD/SVID defines.
--
Yaakov