This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] Deprecate _REENTRANT and _THREAD_SAFE.


On Tue, Dec 6, 2016 at 4:22 PM, Zack Weinberg <zackw@panix.com> wrote:
> 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, I propose to make _REENTRANT and _THREAD_SAFE into aliases
> for _POSIX_C_SOURCE=199506L, and issue a deprecation warning when a
> higher conformance level was not selected some other way.
> For instance, -std=c89 -D_REENTRANT will warn, 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.  I could be persuaded to make that final
> case also warn.

On the assumption that this patch will be merged in some form, I've
queued the following change to feature_test_macros(7):

====
--- a/man7/feature_test_macros.7
+++ b/man7/feature_test_macros.7
@@ -529,13 +529,19 @@ and
 .BR _SVID_SOURCE .
 .TP
 .B _REENTRANT
-Defining this macro exposes definitions of certain reentrant functions.
-For multithreaded programs, use
-.I "cc\ \-pthread"
-instead.
+Historically,
+defining this macro exposed definitions of certain reentrant functions.
+However, already for many years this macro has had few effects,
+and since glibc 2.3, no effects that were not also achieved by defining
+.BR _POSIX_C_SOURCE
+with a value of 199606L or greater.
+This macro is now deprecated; since glibc 2.25,
+defining it has the same effect as defining
+.BR _POSIX_C_SOURCE
+with a value of 199606L or greater.
 .TP
 .B _THREAD_SAFE
-Synonym for
+Synonym for the (deprecated)
 .BR _REENTRANT ,
 provided for compatibility with some other implementations.
 .TP
====

Cheers,

Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]