diff options
author | Joseph Myers <joseph@codesourcery.com> | 2014-02-11 23:40:07 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2014-02-11 23:40:07 +0000 |
commit | c941736c92fa3a319221f65f6755659b2a5e0a20 (patch) | |
tree | 768abe1db4337e5b7044c75232843a34ef0ab0f2 | |
parent | e8d8d7ec98af7c3777fd664adca8be5630afbc90 (diff) | |
download | glibc-c941736c92fa3a319221f65f6755659b2a5e0a20.tar glibc-c941736c92fa3a319221f65f6755659b2a5e0a20.tar.gz glibc-c941736c92fa3a319221f65f6755659b2a5e0a20.tar.bz2 glibc-c941736c92fa3a319221f65f6755659b2a5e0a20.zip |
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.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | include/features.h | 19 | ||||
-rw-r--r-- | manual/creature.texi | 22 | ||||
-rw-r--r-- | manual/filesys.texi | 7 | ||||
-rw-r--r-- | manual/math.texi | 2 | ||||
-rw-r--r-- | manual/signal.texi | 9 | ||||
-rw-r--r-- | manual/startup.texi | 5 | ||||
-rw-r--r-- | math/test-matherr.c | 2 | ||||
-rw-r--r-- | sysvipc/sys/ipc.h | 2 |
10 files changed, 51 insertions, 43 deletions
@@ -1,5 +1,23 @@ 2014-02-11 Joseph Myers <joseph@codesourcery.com> + * 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. + * sysdeps/x86_64/fpu/libm-test-ulps: Update. * elf/dl-lookup.c (ELF_MACHINE_SYM_NO_MATCH): Define if not @@ -13,6 +13,14 @@ Version 2.20 * The am33 port, which had not worked for several years, has been removed from ports. + +* The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer + supported; they now act the same as _DEFAULT_SOURCE (but generate a + warning). Except for cases where _BSD_SOURCE enabled BSD interfaces that + conflicted with POSIX (support for which was removed in 2.19), the + interfaces those macros enabled remain available when compiling with + _GNU_SOURCE defined, with _DEFAULT_SOURCE defined, or without any feature + test macros defined. Version 2.19 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 diff --git a/manual/creature.texi b/manual/creature.texi index bbf16b7f27..3c686165f1 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -73,20 +73,6 @@ edition is made available. @end defvr @comment (none) -@comment GNU -@defvr Macro _BSD_SOURCE -If you define this macro, functionality derived from 4.3 BSD Unix is -included as well as the @w{ISO C}, POSIX.1, and POSIX.2 material. -@end defvr - -@comment (none) -@comment GNU -@defvr Macro _SVID_SOURCE -If you define this macro, functionality derived from SVID is -included as well as the @w{ISO C}, POSIX.1, POSIX.2, and X/Open material. -@end defvr - -@comment (none) @comment X/Open @defvr Macro _XOPEN_SOURCE @comment (none) @@ -192,9 +178,9 @@ precedence. @comment GNU @defvr Macro _DEFAULT_SOURCE If you define this macro, most features are included apart from -X/Open, LFS and GNU extensions; the effect is similar to defining -@code{_POSIX_C_SOURCE} to @code{200809L} and @code{_POSIX_SOURCE}, -@code{_SVID_SOURCE}, and @code{_BSD_SOURCE} to 1. Defining this +X/Open, LFS and GNU extensions: the effect is to enable features from +the 2008 edition of POSIX, as well as certain BSD and SVID features +without a separate feature test macro to control them. Defining this macro, on its own and without using compiler options such as @option{-ansi} or @option{-std=c99}, has the same effect as not defining any feature test macros; defining it together with other @@ -229,4 +215,4 @@ it is harmless to define in addition a feature test macro for a subset of those features. For example, if you define @code{_POSIX_C_SOURCE}, then defining @code{_POSIX_SOURCE} as well has no effect. Likewise, if you define @code{_GNU_SOURCE}, then defining either @code{_POSIX_SOURCE} or -@code{_POSIX_C_SOURCE} or @code{_SVID_SOURCE} as well has no effect. +@code{_POSIX_C_SOURCE} as well has no effect. diff --git a/manual/filesys.texi b/manual/filesys.texi index 1c9d7d7707..9bf5baf2c2 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -893,7 +893,7 @@ seeing this value in a @code{ftw} callback function means the referenced file does not exist. The situation for @code{nftw} is different. This value is only available if the program is compiled with -@code{_BSD_SOURCE} or @code{_XOPEN_EXTENDED} defined before including +@code{_XOPEN_EXTENDED} defined before including the first header. The original SVID systems do not have symbolic links. @end vtable @@ -2553,8 +2553,9 @@ the file's modification time onto disk reliably (the idea being that no-one cares for a swap file). This bit is only available on BSD systems (and those derived from -them). Therefore one has to use the @code{_BSD_SOURCE} feature select -macro to get the definition (@pxref{Feature Test Macros}). +them). Therefore one has to use the @code{_GNU_SOURCE} feature select +macro, or not define any feature test macros, to get the definition +(@pxref{Feature Test Macros}). @end table The actual bit values of the symbols are listed in the table above diff --git a/manual/math.texi b/manual/math.texi index 152744147c..a884cb7c29 100644 --- a/manual/math.texi +++ b/manual/math.texi @@ -106,7 +106,7 @@ The reciprocal of the square root of two (also the square root of 1/2). @end vtable These constants come from the Unix98 standard and were also available in -4.4BSD; therefore they are only defined if @code{_BSD_SOURCE} or +4.4BSD; therefore they are only defined if @code{_XOPEN_SOURCE=500}, or a more general feature select macro, is defined. The default set of features includes these constants. @xref{Feature Test Macros}. diff --git a/manual/signal.texi b/manual/signal.texi index f0e57ddbe4..51f68b5d3e 100644 --- a/manual/signal.texi +++ b/manual/signal.texi @@ -2141,16 +2141,9 @@ that handler will cause @code{EINTR}. @xref{Flags for Sigaction}. Another way to specify the choice is with the @code{siginterrupt} function. @xref{BSD Handler}. -@c !!! not true now about _BSD_SOURCE When you don't specify with @code{sigaction} or @code{siginterrupt} what a particular handler should do, it uses a default choice. The default -choice in @theglibc{} depends on the feature test macros you have -defined. If you define @code{_BSD_SOURCE} or @code{_GNU_SOURCE} before -calling @code{signal}, the default is to resume primitives; otherwise, -the default is to make them fail with @code{EINTR}. (The library -contains alternate versions of the @code{signal} function, and the -feature test macros determine which one you really call.) @xref{Feature -Test Macros}. +choice in @theglibc{} is to make primitives fail with @code{EINTR}. @cindex EINTR, and restarting interrupted primitives @cindex restarting interrupted primitives @cindex interrupting primitives diff --git a/manual/startup.texi b/manual/startup.texi index a5d2d2f5e2..9a091a5151 100644 --- a/manual/startup.texi +++ b/manual/startup.texi @@ -379,9 +379,8 @@ reflect automatically in the environment. This also requires that variable is removed from the environment. The same applies of course to dynamically allocated variables which are freed later. -This function is part of the extended Unix interface. Since it was also -available in old SVID libraries you should define either -@var{_XOPEN_SOURCE} or @var{_SVID_SOURCE} before including any header. +This function is part of the extended Unix interface. You should define +@var{_XOPEN_SOURCE} before including any header. @end deftypefun diff --git a/math/test-matherr.c b/math/test-matherr.c index 91657a8cb2..cd09a3981c 100644 --- a/math/test-matherr.c +++ b/math/test-matherr.c @@ -1,5 +1,3 @@ -#undef _SVID_SOURCE -#define _SVID_SOURCE #include <math.h> #include <stdio.h> #include <stdlib.h> diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h index 8d5d6ac5df..a1af5314f4 100644 --- a/sysvipc/sys/ipc.h +++ b/sysvipc/sys/ipc.h @@ -21,7 +21,7 @@ #include <features.h> #if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2 -# warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE" +# warning "Files using this header must be compiled with _GNU_SOURCE or _XOPEN_SOURCE" #endif /* Get system dependent definition of `struct ipc_perm' and more. */ |