From nobody Wed Dec 22 10:06:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B86AA1906F99; Wed, 22 Dec 2021 10:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JJprl3CD6z4Z1Z; Wed, 22 Dec 2021 10:06:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AC101B463; Wed, 22 Dec 2021 10:06:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BMA6fW3093018; Wed, 22 Dec 2021 10:06:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BMA6fQS093017; Wed, 22 Dec 2021 10:06:41 GMT (envelope-from git) Date: Wed, 22 Dec 2021 10:06:41 GMT Message-Id: <202112221006.1BMA6fQS093017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 0e426a4a3468 - stable/12 - [libcxx] Guard C++20 atomic type aliases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0e426a4a346876e61adc0b3981a91fe1e039c1ee Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640167607; 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=ck+7JoZ7t8lEXCVu4iUyvl6MvBhDHoaKMVfTVvPgHkc=; b=MkePVoQF4EUZBxjUik94OeJbQBI+STS+ur4Tv9K41ivHsl0PqSZKJh5y2TaxoQmE9wm+KH /5vyIwXGYuKDCdg1YbGiwYnbvqxFz3ng7IhBW1o9WY09coZR9usoLoWOHPhIb+emC/htMz Dd8NAsjDhqZjncKxOojd7yZmPtJdzpKyhcQdGm0UR2/T+zDZpizkXfh39Cy1ekC8OrXYs0 X3E6sCVeAbHIwb0EfbKu8qby9rCbR8HlUMAcr2LQ9KHUqjqF3htEXlaxdZUZW1jgtSOuzw gPzI3J+Pk2W6vhG0OvuN0CjEV6qbQRmqzS710zfbnhvu2rL1IJi7AJAltRRBFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640167607; a=rsa-sha256; cv=none; b=IoJkyvWZcn/udxNHmNdDLHGGjKk4SCypuFQDakKvesPvmi/ctGXX1QcY+4EYgnRAhYc7OZ PPT3kGOVPxmrXH6hA6uTVoCliRc2J2qIZhPmhPC9q3y6fTZROKmBTX14bU7vl1z+0owzSo 2zmhtczHJwCMovzuoc7aJaZ9AkIWe7N7ghqqPMMcQJ6bOW8TGyV9hBBchcn1eVmrru/ePB a3IoSXaWYvggWCMf2jkna2g+ca2lmmFuwylGA1xx9oii4i12wq3edJ2bRw5kYo494Tpjxe NRsYDEgeozl2bu3qtAUekF8DoJtc9A7TFd3sGBzsbdnhzaSgdkCutfHKrRmcjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0e426a4a346876e61adc0b3981a91fe1e039c1ee commit 0e426a4a346876e61adc0b3981a91fe1e039c1ee Author: Dimitry Andric AuthorDate: 2021-12-17 22:10:49 +0000 Commit: Dimitry Andric CommitDate: 2021-12-22 10:01:33 +0000 [libcxx] Guard C++20 atomic type aliases Apply abandoned llvm review https://reviews.llvm.org/D75183 anyway: The std::atomic_signed_lock_free and std::atomic_unsigned_lock_free typedefs are a C++20 feature and should be guarded with an #if, so that they don't get defined in C++17 and prior versions. Also with the current implementation inclusion of the header will fail the compilation for targets that don't have lock-free atomic integers (e.g. Armv6-M) because __libcpp_signed_lock_free and __libcpp_unsigned_lock_free will not get defined. We should not try to define std::atomic_signed_lock_free and std::atomic_unsigned_lock_free in this case as well (according to [atomics.alias]/2 these typedefs are optional in freestanding implementations). --- contrib/llvm-project/libcxx/include/atomic | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/llvm-project/libcxx/include/atomic b/contrib/llvm-project/libcxx/include/atomic index 5ab48f55ddd3..264023405516 100644 --- a/contrib/llvm-project/libcxx/include/atomic +++ b/contrib/llvm-project/libcxx/include/atomic @@ -2761,6 +2761,8 @@ typedef atomic atomic_uintmax_t; # define _LIBCPP_CONTENTION_LOCK_FREE false #endif +#if _LIBCPP_STD_VER > 17 + #if ATOMIC_LLONG_LOCK_FREE == 2 typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long>::type __libcpp_signed_lock_free; typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long>::type __libcpp_unsigned_lock_free; @@ -2775,10 +2777,15 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free; #else // No signed/unsigned lock-free types +# define _LIBCPP_CANNOT_DEFINE_ATOMIC_LOCK_FREE_TYPE_ALIASES #endif +#ifndef _LIBCPP_CANNOT_DEFINE_ATOMIC_LOCK_FREE_TYPE_ALIASES typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free; typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free; +#endif + +#endif // _LIBCPP_STD_VER > 17 #define ATOMIC_FLAG_INIT {false} #define ATOMIC_VAR_INIT(__v) {__v}