From patchwork Thu Dec 8 09:01:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kerrisk \\(man-pages\\)" X-Patchwork-Id: 18282 Received: (qmail 84684 invoked by alias); 8 Dec 2016 09:01:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 84663 invoked by uid 89); 8 Dec 2016 09:01:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=2.3, Hx-languages-length:1961, queued X-HELO: mail-yw0-f195.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=YRLyG7gEeLnD+sLnbRJtQpOcWrpsoZKFC+Y6yDI39Uk=; b=mPEkJGPEN1GDNRKAMyL4kJ6b4yS0LVynmqD9137MEFwr/ZQjvqLWIE1URfk0xTzmFg sV4DZTmyql4c7MJtOSCuw12EAzt+/ow57rGbPhXVCx9h/LU2NcS80cviOCYOa3PeSTbU MM860PMlK9d42CLgeMXtDXVvMVm4t+at0dhbOSHULcpzCX1IakXSE5igYMdBWhJa9SH8 dEUC4+MwOEeuaj9iLFhpu1Kw7k2Hhqs85LpOrC565/GOPI1iSdtT/7fjq18UuumExaHe psVS6aAbgP/ly5+p5K3WBD/k7uyfS7kiHe/C9jnxI6Tw1dFmPtCjx42rRNIWeiXqVaHz TVow== X-Gm-Message-State: AKaTC00J9wjsTtOUprWsakTAvqaoOqoOfCUH73mk1qcWDLlBipS1BANBQrwiOTv7dvl5nBs2W19P35A3xfhTGQ== X-Received: by 10.37.65.9 with SMTP id o9mr2055639yba.65.1481187692029; Thu, 08 Dec 2016 01:01:32 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20161206152204.2064-1-zackw@panix.com> References: <20161206152204.2064-1-zackw@panix.com> From: Michael Kerrisk Date: Thu, 8 Dec 2016 10:01:31 +0100 Message-ID: Subject: Re: [RFC PATCH] Deprecate _REENTRANT and _THREAD_SAFE. To: Zack Weinberg Cc: libc-alpha , Michael Kerrisk-manpages On Tue, Dec 6, 2016 at 4:22 PM, Zack Weinberg 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): ==== Cheers, Michael ==== --- 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