From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 889BC3858427 for ; Tue, 27 Feb 2024 11:45:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 889BC3858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 889BC3858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709034342; cv=none; b=XPx2gm6udZD2Y8QNKI2liwoYlZvovkAU6chaRYAlesk6u6s+vQ/1uSTKRs5mVumqPzPU2DGj9YZFibLHVf/LJ4ND8vptFpEVTQVSpbPu28T4/LB3tCwx7iZfh5wqeNiCUR5cNDljV46h3XL0pgX0dQ3u/9/Ph5JBifIp6RzMoEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709034342; c=relaxed/simple; bh=nI+hQJIGoxfPmppy51RRDZqSU5rNq3wpxDFYUEXidVY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RYH9xmex9sycvYme+UkS42Tmtdkz84muMDQf826kiubti6QTX1+FgrmI5GhT/R0MpAXj3FxES3lUaym+eLrMMSSAQaz4cgtC23oE4QSaKGSYVEHOIKy7QqvKHOwoUdWTJIPQif33pIcDxiZejJ1tRtceSRFLXlmqsM97OfZwwIs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709034337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KpZ/mnAwGB0Zt+fNe62/bM2BnZxfEbHV8c/tiTBzONA=; b=PGJFkR+wN1hhMDIqs43FqD03+79eagPUDHb5BR5/44Ng8hDkrJma+OrPPDsKZvUaKoMwUQ z7E6+PVv56XjB2QDEyeg9Yk3a4YbLCLa4x687NO41wKlM2BrEOo1Hq9yRCvBEdG0gzhrOm otApmNc2IOjiv+AAUhdjOMtclBL3K40= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-ZUDFVj85NwuOgrGPWtLHRg-1; Tue, 27 Feb 2024 06:45:35 -0500 X-MC-Unique: ZUDFVj85NwuOgrGPWtLHRg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F88388B760; Tue, 27 Feb 2024 11:45:35 +0000 (UTC) Received: from localhost (unknown [10.42.28.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DB0E40C122C; Tue, 27 Feb 2024 11:45:35 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 8/8] libstdc++: Do not define lock-free atomic aliases if not fully lock-free [PR114103] Date: Tue, 27 Feb 2024 11:42:05 +0000 Message-ID: <20240227114528.1350601-8-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Tested x86_64-linux. I think we should make this change, because otherwise we define the typedefs for platforms with no lock-free atomics, like hppa-hpux. Instead of lying, those typedefs should be absent on that target. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/114103 * include/bits/version.def (atomic_lock_free_type_aliases): Add extra_cond to check for at least one always-lock-free type. * include/bits/version.h: Regenerate. * include/std/atomic (atomic_signed_lock_free) (atomic_unsigned_lock_free): Only use always-lock-free types. --- libstdc++-v3/include/bits/version.def | 1 + libstdc++-v3/include/bits/version.h | 2 +- libstdc++-v3/include/std/atomic | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 502961eb269..d298420121b 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -739,6 +739,7 @@ ftms = { values = { v = 201907; cxxmin = 20; + extra_cond = "(__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2"; }; }; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 7a6fbd35e2e..9107b45a484 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -819,7 +819,7 @@ #undef __glibcxx_want_atomic_float #if !defined(__cpp_lib_atomic_lock_free_type_aliases) -# if (__cplusplus >= 202002L) +# if (__cplusplus >= 202002L) && ((__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2) # define __glibcxx_atomic_lock_free_type_aliases 201907L # if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_lock_free_type_aliases) # define __cpp_lib_atomic_lock_free_type_aliases 201907L diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index 559f8370459..1462cf5ec23 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -1774,13 +1774,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION = atomic>; using atomic_unsigned_lock_free = atomic>; -# elif ATOMIC_INT_LOCK_FREE || !(ATOMIC_LONG_LOCK_FREE || ATOMIC_CHAR_LOCK_FREE) +# elif ATOMIC_INT_LOCK_FREE == 2 using atomic_signed_lock_free = atomic; using atomic_unsigned_lock_free = atomic; -# elif ATOMIC_LONG_LOCK_FREE +# elif ATOMIC_LONG_LOCK_FREE == 2 using atomic_signed_lock_free = atomic; using atomic_unsigned_lock_free = atomic; -# elif ATOMIC_CHAR_LOCK_FREE +# elif ATOMIC_CHAR_LOCK_FREE == 2 using atomic_signed_lock_free = atomic; using atomic_unsigned_lock_free = atomic; # else -- 2.43.0