From 5edbc6fe13e1e0f27e3d3a20f2582da476f74c4b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 10 Sep 2014 12:47:55 -0400 Subject: add _DEFAULT_SOURCE feature profile as an alias for _BSD_SOURCE as a result of commit ab8f6a6e42ff893041f7545a23e6d6a0edde07fb, this definition is now equivalent to the actual "default profile" which appears immediately below in features.h, and which defines both _BSD_SOURCE and _XOPEN_SOURCE. the intent of providing a _DEFAULT_SOURCE, which glibc also now provides, is to give applications a way to "get back" the default feature profile when it was lost either by compiler flags that inhibit it (such as -std=c99) or by library-provided predefined macros (such as -D_POSIX_C_SOURCE=200809L) which may inhibit exposure of features that were otherwise visible by default and which the application may need. without _DEFAULT_SOURCE, the application had encode knowledge of a particular libc's defaults, and such knowledge was fragile and subject to bitrot. eventually the names _GNU_SOURCE and _BSD_SOURCE should be phased out in favor of the more-descriptive and more-accurate _ALL_SOURCE and _DEFAULT_SOURCE, leaving the old names as aliases but using the new ones internally. however this is a more invasive change that would require extensive regression testing, so it is deferred. --- include/features.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/features.h b/include/features.h index 61ad2f5b..3cc3e579 100644 --- a/include/features.h +++ b/include/features.h @@ -5,6 +5,10 @@ #define _GNU_SOURCE 1 #endif +#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE) +#define _BSD_SOURCE 1 +#endif + #if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \ && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \ && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__) -- cgit v1.2.1