From patchwork Fri May 13 12:40:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 53936 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B43B395BC51 for ; Fri, 13 May 2022 12:55:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B43B395BC51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652446502; bh=aw3iUmblrmEOs/y7NcDVJvlWQvZ1BzVf/dO2kGlmjfI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kjG4zzLyU4CdaO/pFXjGXg8NPbJKvJmGdIHZ23uZYfLdwUt9teLaTqI+kqSWDsSlc wLCSQlbYxng19JUQQrDabFxVcewEKto7hECF0MCI02B6L8oLfBEpAEJ5qlsC9Ls3Ct NMuA4XKNxn4SEt3oo0Qw6c/HgogKz79XNTwYZ94A= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 14FAC395A00D for ; Fri, 13 May 2022 12:41:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14FAC395A00D 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-255-STvvTCpUPMOTvDqOv-ybuQ-1; Fri, 13 May 2022 08:40:56 -0400 X-MC-Unique: STvvTCpUPMOTvDqOv-ybuQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA5EE18A6585; Fri, 13 May 2022 12:40:55 +0000 (UTC) Received: from localhost (unknown [10.33.36.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF7381121330; Fri, 13 May 2022 12:40:55 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 06/12] libstdc++: Improve doxygen docs for Date: Fri, 13 May 2022 13:40:44 +0100 Message-Id: <20220513124050.4028450-6-jwakely@redhat.com> In-Reply-To: <20220513124050.4028450-1-jwakely@redhat.com> References: <20220513124050.4028450-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 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_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested powerpc64le-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/std/atomic: Suppress doxygen docs for implementation details. * include/bits/atomic_base.h: Likewise. * include/bits/shared_ptr_atomic.h: Use markdown. Fix grouping so that std::atomic is not added to the pointer abstractions group. --- libstdc++-v3/include/bits/atomic_base.h | 41 ++++++++++++++----- libstdc++-v3/include/bits/shared_ptr_atomic.h | 32 +++++++++------ libstdc++-v3/include/std/atomic | 11 +++-- 3 files changed, 57 insertions(+), 27 deletions(-) diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 5cf217dbf28..d29e4434177 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -86,6 +86,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } memory_order; #endif + /// @cond undocumented enum __memory_order_modifier { __memory_order_mask = 0x0ffff, @@ -93,6 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __memory_order_hle_acquire = 0x10000, __memory_order_hle_release = 0x20000 }; + /// @endcond constexpr memory_order operator|(memory_order __m, __memory_order_modifier __mod) @@ -106,6 +108,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return memory_order(int(__m) & int(__mod)); } + /// @cond undocumented + // Drop release ordering as per [atomics.types.operations.req]/21 constexpr memory_order __cmpexch_failure_order2(memory_order __m) noexcept @@ -128,6 +132,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION && (__m & __memory_order_mask) != memory_order_acq_rel; } + // Base types for atomics. + template + struct __atomic_base; + + /// @endcond + _GLIBCXX_ALWAYS_INLINE void atomic_thread_fence(memory_order __m) noexcept { __atomic_thread_fence(int(__m)); } @@ -145,17 +155,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __ret; } - // Base types for atomics. - template - struct __atomic_base; - -#if __cplusplus <= 201703L -# define _GLIBCXX20_INIT(I) -#else +#if __cplusplus >= 202002L # define __cpp_lib_atomic_value_initialization 201911L -# define _GLIBCXX20_INIT(I) = I #endif +/// @cond undocumented +#if __cpp_lib_atomic_value_initialization +# define _GLIBCXX20_INIT(I) = I +#else +# define _GLIBCXX20_INIT(I) +#endif +/// @endcond + #define ATOMIC_VAR_INIT(_VI) { _VI } template @@ -171,8 +182,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef unsigned char __atomic_flag_data_type; #endif - /** - * @brief Base type for atomic_flag. + /// @cond undocumented + + /* + * Base type for atomic_flag. * * Base type is POD with data, allowing atomic_flag to derive from * it and meet the standard layout type requirement. In addition to @@ -190,6 +203,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_EXTERN_C + /// @endcond + #define ATOMIC_FLAG_INIT { 0 } /// atomic_flag @@ -295,6 +310,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __i ? __GCC_ATOMIC_TEST_AND_SET_TRUEVAL : 0; } }; + /// @cond undocumented /// Base class for atomic integrals. // @@ -936,7 +952,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), int(__m)); } }; + /// @endcond + #if __cplusplus > 201703L + /// @cond undocumented + // Implementation details of atomic_ref and atomic. namespace __atomic_impl { @@ -1936,6 +1956,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Tp** _M_ptr; }; + /// @endcond #endif // C++2a /// @} group atomics diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h index ff86432f0b4..d4bd712fc7d 100644 --- a/libstdc++-v3/include/bits/shared_ptr_atomic.h +++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h @@ -38,9 +38,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @addtogroup pointer_abstractions + * @relates shared_ptr * @{ */ - /// @relates shared_ptr @{ /// @cond undocumented @@ -94,8 +94,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @param __p A non-null pointer to a shared_ptr object. * @return @c *__p * - * The memory order shall not be @c memory_order_release or - * @c memory_order_acq_rel. + * The memory order shall not be `memory_order_release` or + * `memory_order_acq_rel`. * @{ */ template @@ -130,8 +130,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @param __p A non-null pointer to a shared_ptr object. * @param __r The value to store. * - * The memory order shall not be @c memory_order_acquire or - * @c memory_order_acq_rel. + * The memory order shall not be `memory_order_acquire` or + * `memory_order_acq_rel`. * @{ */ template @@ -167,8 +167,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Atomic exchange for shared_ptr objects. * @param __p A non-null pointer to a shared_ptr object. - * @param __r New value to store in @c *__p. - * @return The original value of @c *__p + * @param __r New value to store in `*__p`. + * @return The original value of `*__p` * @{ */ template @@ -214,10 +214,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @param __p A non-null pointer to a shared_ptr object. * @param __v A non-null pointer to a shared_ptr object. * @param __w A non-null pointer to a shared_ptr object. - * @return True if @c *__p was equivalent to @c *__v, false otherwise. + * @return True if `*__p` was equivalent to `*__v`, false otherwise. * - * The memory order for failure shall not be @c memory_order_release or - * @c memory_order_acq_rel, or stronger than the memory order for success. + * The memory order for failure shall not be `memory_order_release` or + * `memory_order_acq_rel`. * @{ */ template @@ -327,11 +327,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } /// @} + /// @} group pointer_abstractions + #if __cplusplus >= 202002L # define __cpp_lib_atomic_shared_ptr 201711L template class atomic; + /** + * @addtogroup pointer_abstractions + * @relates shared_ptr + * @{ + */ + template static constexpr bool __is_shared_ptr = false; template @@ -788,10 +796,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: _Sp_atomic> _M_impl; }; -#endif // C++20 - - /// @} relates shared_ptr /// @} group pointer_abstractions +#endif // C++20 _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index d819b6bf41e..1c6acfa36d0 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -181,11 +181,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // __cpp_lib_atomic_wait }; -#if __cplusplus <= 201703L -# define _GLIBCXX20_INIT(I) -#else +/// @cond undocumented +#if __cpp_lib_atomic_value_initialization # define _GLIBCXX20_INIT(I) = I +#else +# define _GLIBCXX20_INIT(I) #endif +/// @endcond /** * @brief Generic atomic type, primary class template. @@ -1241,11 +1243,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION atomic_flag_clear(volatile atomic_flag* __a) noexcept { atomic_flag_clear_explicit(__a, memory_order_seq_cst); } - + /// @cond undocumented template using __atomic_val_t = typename atomic<_Tp>::value_type; template using __atomic_diff_t = typename atomic<_Tp>::difference_type; + /// @endcond // [atomics.nonmembers] Non-member functions. // Function templates generally applicable to atomic types.