path: root/include/features.h
diff options
authorRich Felker <>2014-09-10 12:47:55 -0400
committerRich Felker <>2014-09-10 12:47:55 -0400
commit5edbc6fe13e1e0f27e3d3a20f2582da476f74c4b (patch)
tree911e05d0aa3f6f1f33869e3daa759aa0d4685051 /include/features.h
parentf929493c49bbb304832b27e1e2b919aa19ddf470 (diff)
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.
Diffstat (limited to 'include/features.h')
1 files changed, 4 insertions, 0 deletions
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
+#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
+#define _BSD_SOURCE 1
#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
&& !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
&& !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)