From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from 1.mo575.mail-out.ovh.net (1.mo575.mail-out.ovh.net [46.105.41.146]) by sourceware.org (Postfix) with ESMTPS id 99FA23858C20 for ; Sat, 30 Sep 2023 12:34:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99FA23858C20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sk2.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sk2.org Received: from director4.ghost.mail-out.ovh.net (unknown [10.108.16.29]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 490562598B for ; Sat, 30 Sep 2023 12:34:18 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-t2k5z (unknown [10.110.171.34]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 1643F1FD88; Sat, 30 Sep 2023 12:34:18 +0000 (UTC) Received: from sk2.org ([37.59.142.101]) by ghost-submission-6684bf9d7b-t2k5z with ESMTPSA id PHTDAsoVGGWZBAEAnmHt8A (envelope-from ); Sat, 30 Sep 2023 12:34:18 +0000 Authentication-Results:garm.ovh; auth=pass (GARM-101G0043a6886c9-04bc-4793-96b4-f6b1000b32bc, 10411C1C120163AF23A4499D0E0B4D6CE375B5E5) smtp.auth=steve@sk2.org X-OVh-ClientIp:82.65.25.201 From: Stephen Kitt To: gcc-patches@gcc.gnu.org Cc: Stephen Kitt Subject: [PATCH] mingw-w64: avoid undefining _REENTRANT Date: Sat, 30 Sep 2023 14:33:53 +0200 Message-Id: <20230930123353.2575906-1-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 1570067423789942406 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedruddtgdeftdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepufhtvghphhgvnhcumfhithhtuceoshhtvghvvgesshhkvddrohhrgheqnecuggftrfgrthhtvghrnhepleegteeujeffjeefjeevhfdtudefjefgteelgedtudekleeiledvvdetudevjedtnecukfhppeduvdejrddtrddtrddupdekvddrieehrddvhedrvddtuddpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehgtggtqdhprghttghhvghssehgtggtrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: When pthread is used by default, _REENTRANT should be defined in all cases except -no-pthread. When pthread is not used by default, _REENTRANT should only be defined with -pthread. The current spec for mingw-w64 for default pthread is %{!no-pthread:-D_REENTRANT} %{pthread:-U_REENTRANT} and for non-default pthread is %{pthread:-D_REENTRANT} %{!no-pthread:-U_REENTRANT} This means that when pthread is used by default, specifying -pthread undefines _REENTRANT! Applying the mingw32 specs instead produces the desired result, %{!no-pthread:-D_REENTRANT} %{pthread: } for default pthread, and %{pthread:-D_REENTRANT} %{!no-pthread: } for non-default pthread. gcc/ChangeLog: * config/i386/mingw-w64.h (CPP_SPEC): Never undefine _REENTRANT, only define it when appropriate. Signed-off-by: Stephen Kitt --- gcc/config/i386/mingw-w64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h index 0146ed4f793..39e7ec2ea1e 100644 --- a/gcc/config/i386/mingw-w64.h +++ b/gcc/config/i386/mingw-w64.h @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \ "%{municode:-DUNICODE} " \ "%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \ - "%{" SPEC_PTHREAD2 ":-U_REENTRANT} " \ + "%{" SPEC_PTHREAD2 ": } " \ "%{mcrtdll=crtdll*:-U__MSVCRT__ -D__CRTDLL__} " \ "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \ "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \ base-commit: 1e6815071fd137424f79ca79a6ba66b776a98778 -- 2.30.2