From c941736c92fa3a319221f65f6755659b2a5e0a20 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 11 Feb 2014 23:40:07 +0000 Subject: Remove _BSD_SOURCE and _SVID_SOURCE. This is a minimal patch to remove _BSD_SOURCE and _SVID_SOURCE from the documented user API, making them into aliases for _DEFAULT_SOURCE with a #warning given, but keeping most of the features.h logic using those macros and all the exising __USE_* conditionals, on the basis that all the consequent cleanups will go in followup patches. Tested x86_64. * include/features.h: Update comment documenting feature test macros. [_BSD_SOURCE || _SVID_SOURCE]: Give #warning. Define _DEFAULT_SOURCE. * manual/creature.texi (_BSD_SOURCE): Remove documentation. (_SVID_SOURCE): Likewise. (_DEFAULT_SOURCE): Update description of default features. (Feature Test Macros): Don't mention _SVID_SOURCE in conjunction with _GNU_SOURCE. * manual/filesys.texi (__ftw_func_t): Do not refer to _BSD_SOURCE. (S_ISVTX): Likewise. * manual/math.texi (Mathematical Constants): Likewise. * manual/signal.texi (Interrupted Primitives): Likewise. * manual/startup.texi (putenv): Do not refer to _SVID_SOURCE. * math/test-matherr.c (_SVID_SOURCE): Do not define. * sysvipc/sys/ipc.h [__USE_SVID && !__USE_XOPEN && __GNUC__ >= 2]: Don't refer to _SVID_SOURCE in warning text. --- include/features.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'include/features.h') diff --git a/include/features.h b/include/features.h index 21173a28c3..c729a3fc0d 100644 --- a/include/features.h +++ b/include/features.h @@ -37,8 +37,6 @@ _LARGEFILE_SOURCE Some more functions for correct standard I/O. _LARGEFILE64_SOURCE Additional functionality from LFS for large files. _FILE_OFFSET_BITS=N Select default filesystem interface. - _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. - _SVID_SOURCE ISO C, POSIX, and SVID things. _ATFILE_SOURCE Additional *at interfaces. _GNU_SOURCE All of the above, plus GNU extensions. _DEFAULT_SOURCE The default set of features (taking precedence over @@ -51,11 +49,11 @@ The `-ansi' switch to the GNU C compiler, and standards conformance options such as `-std=c99', define __STRICT_ANSI__. If none of these are defined, or if _DEFAULT_SOURCE is defined, the default is - to have _SVID_SOURCE, _BSD_SOURCE, and _POSIX_SOURCE set to one and - _POSIX_C_SOURCE set to 200809L. If more than one of these are - defined, they accumulate. For example __STRICT_ANSI__, - _POSIX_SOURCE and _POSIX_C_SOURCE together give you ISO C, 1003.1, - and 1003.2, but nothing else. + to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to + 200809L, as well as enabling miscellaneous functions from BSD and + SVID. If more than one of these are defined, they accumulate. For + example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together + give you ISO C, 1003.1, and 1003.2, but nothing else. These are defined by this file and are used by the header files to decide what to declare or define: @@ -145,6 +143,13 @@ # define __GNUC_PREREQ(maj, min) 0 #endif +/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for + _DEFAULT_SOURCE. */ +#if defined _BSD_SOURCE || defined _SVID_SOURCE +# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" +# undef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 +#endif /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ #ifdef _GNU_SOURCE -- cgit 1.4.1