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.129.124]) by sourceware.org (Postfix) with ESMTPS id 4A061383139F for ; Thu, 24 Aug 2023 12:45:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4A061383139F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692881141; 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=gI9vn0QP8sqCvWP+DtBqetAwFF6IpL1FmdbCxOth+IE=; b=hH9JMKs0XZjMCP74AkrmhPAZ8EazBhN1fEAA1zzFzDsS70akxlvPYCABY7keKQKCqblPdD aijuASCV3mxkZKwiIIHhVNiVInFkNEY9lgWR5BTgL1LOp0UiglWDwzmxGS9EF50mSatmty Fx9ZauzBJM1BelXHNpH7w85LMU86Z+U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-473-Je3rSBQENz-gyD9dKtLoNA-1; Thu, 24 Aug 2023 08:45:38 -0400 X-MC-Unique: Je3rSBQENz-gyD9dKtLoNA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B24F9185A791; Thu, 24 Aug 2023 12:45:37 +0000 (UTC) Received: from localhost (unknown [10.42.28.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 783436B2B2; Thu, 24 Aug 2023 12:45:37 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Tweak some preprocessor conditions for feature tests Date: Thu, 24 Aug 2023 13:45:25 +0100 Message-ID: <20230824124536.443669-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 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 autolearn=unavailable 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. Pushed to trunk. -- >8 -- Update a preprocessor condition using __cplusplus and _GLIBCXX_HOSTED to use the relevant feature test macro for . Also add comments to some conditions saying which C++ standard revision the check corresponds to. libstdc++-v3/ChangeLog: * include/std/atomic: Add comment to #ifdef and fix indentation. * include/std/ostream: Check __glibcxx_syncbuf instead of __cplusplus and _GLIBCXX_HOSTED. * include/std/thread: Add comment to #ifdef. --- libstdc++-v3/include/std/atomic | 28 ++++++++++++++-------------- libstdc++-v3/include/std/ostream | 6 +++--- libstdc++-v3/include/std/thread | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index da99169cab5..713ee2cc539 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -388,23 +388,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return compare_exchange_strong(__e, __i, __m, __cmpexch_failure_order(__m)); } -#if __cpp_lib_atomic_wait - void - wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept - { - std::__atomic_wait_address_v(&_M_i, __old, - [__m, this] { return this->load(__m); }); - } +#if __cpp_lib_atomic_wait // C++ >= 20 + void + wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept + { + std::__atomic_wait_address_v(&_M_i, __old, + [__m, this] { return this->load(__m); }); + } - // TODO add const volatile overload + // TODO add const volatile overload - void - notify_one() noexcept - { std::__atomic_notify_address(&_M_i, false); } + void + notify_one() noexcept + { std::__atomic_notify_address(&_M_i, false); } - void - notify_all() noexcept - { std::__atomic_notify_address(&_M_i, true); } + void + notify_all() noexcept + { std::__atomic_notify_address(&_M_i, true); } #endif // __cpp_lib_atomic_wait }; diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 4711b8a3d96..5f973fa11ed 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -39,6 +39,7 @@ #include #include +#include // __glibcxx_syncbuf namespace std _GLIBCXX_VISIBILITY(default) { @@ -804,7 +805,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::move(__os); } -#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI +#ifdef __glibcxx_syncbuf // C++ >= 20 && HOSTED && CXX11ABI template class __syncbuf_base : public basic_streambuf<_CharT, _Traits> { @@ -869,8 +870,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __os.flush(); return __os; } - -#endif // C++20 +#endif // __glibcxx_syncbuf #endif // C++11 diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index 2c049edcbd6..28582c9df5c 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -106,7 +106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } /// @} -#ifdef __cpp_lib_jthread +#ifdef __cpp_lib_jthread // C++ >= 20 /// @cond undocumented #ifndef __STRICT_ANSI__ -- 2.41.0