This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: [PATCH v2 1/4] Feature test macro overhaul


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


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