From c03073774f915fe7841c2b551fe304544143470f Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 6 Dec 2016 10:14:42 -0500 Subject: Make _REENTRANT and _THREAD_SAFE aliases for _POSIX_C_SOURCE=199506L. For many years, the only effect of these macros has been to make unistd.h declare getlogin_r. _POSIX_C_SOURCE >= 199506L also causes this function to be declared. However, people who don't carefully read all the headers might be confused into thinking they need to define _REENTRANT for any threaded code (as was indeed the case a long time ago). Therefore, remove __USE_REENTRANT, and make _REENTRANT and _THREAD_SAFE into synonyms for _POSIX_C_SOURCE=199506L. This will only affect programs that don't select a higher conformance level some other way. For instance, -std=c89 -D_REENTRANT will see a change in visible declarations, but -std=c99 -D_POSIX_C_SOURCE=200809L -D_REENTRANT won't, and -D_REENTRANT all by itself also won't, because _DEFAULT_SOURCE implies _POSIX_C_SOURCE > 199506. * include/features.h: Remove __USE_REENTRANT. Treat _REENTRANT and _THREAD_SAFE the same as _POSIX_C_SOURCE=199506L, if a higher POSIX conformance level has not been selected by other macros. * NEWS, manual/creature.texi: Document this change. * posix/unistd.h, posix/bits/unistd.h: Don't check __USE_REENTRANT. * include/libc-symbols.h: Don't define _REENTRANT. * scripts/check-installed-headers.sh: Don't undefine _REENTRANT. --- manual/creature.texi | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'manual/creature.texi') diff --git a/manual/creature.texi b/manual/creature.texi index 257f8718b1..5048886292 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -219,15 +219,11 @@ cause them to be disabled. @comment GNU @defvr Macro _REENTRANT @defvrx Macro _THREAD_SAFE -If you define one of these macros, reentrant versions of several functions get -declared. Some of the functions are specified in POSIX.1c but many others -are only available on a few other systems or are unique to @theglibc{}. -The problem is the delay in the standardization of the thread safe C library -interface. - -Unlike on some other systems, no special version of the C library must be -used for linking. There is only one version but while compiling this -it must have been specified to compile as thread safe. +These macros are obsolete. They have the same effect as defining +@code{_POSIX_C_SOURCE} with the value @code{199506L}. + +Some very old C libraries required one of these macros to be defined +for basic functionality (e.g.@: @code{getchar}) to be thread-safe. @end defvr We recommend you use @code{_GNU_SOURCE} in new programs. If you don't -- cgit 1.4.1