From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 35AA9385841A; Tue, 5 Oct 2021 08:36:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35AA9385841A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-4180] libstdc++: Add noexcept to some std::function internals X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 96955a82f0e1624a20ea2c9953d76a20ea433c24 X-Git-Newrev: 9665c2e76849c8e0066c6660779ae082fce67ea8 Message-Id: <20211005083614.35AA9385841A@sourceware.org> Date: Tue, 5 Oct 2021 08:36:14 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 08:36:14 -0000 https://gcc.gnu.org/g:9665c2e76849c8e0066c6660779ae082fce67ea8 commit r12-4180-g9665c2e76849c8e0066c6660779ae082fce67ea8 Author: Jonathan Wakely Date: Mon Oct 4 15:22:58 2021 +0100 libstdc++: Add noexcept to some std::function internals libstdc++-v3/ChangeLog: * include/bits/std_function.h (_Any_data::_M_access): Add noexcept. (_Function_base::_Base_manager::_M_get_pointer): Likewise. (_Function_base::_Base_manager::_M_not_empty_function): Likewise. Diff: --- libstdc++-v3/include/bits/std_function.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/include/bits/std_function.h b/libstdc++-v3/include/bits/std_function.h index 3dda820bd1a..55738440949 100644 --- a/libstdc++-v3/include/bits/std_function.h +++ b/libstdc++-v3/include/bits/std_function.h @@ -82,17 +82,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION union [[gnu::may_alias]] _Any_data { - void* _M_access() { return &_M_pod_data[0]; } - const void* _M_access() const { return &_M_pod_data[0]; } + void* _M_access() noexcept { return &_M_pod_data[0]; } + const void* _M_access() const noexcept { return &_M_pod_data[0]; } template _Tp& - _M_access() + _M_access() noexcept { return *static_cast<_Tp*>(_M_access()); } template const _Tp& - _M_access() const + _M_access() const noexcept { return *static_cast(_M_access()); } _Nocopy_types _M_unused; @@ -131,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Retrieve a pointer to the function object static _Functor* - _M_get_pointer(const _Any_data& __source) + _M_get_pointer(const _Any_data& __source) noexcept { if _GLIBCXX17_CONSTEXPR (__stored_locally) { @@ -217,22 +217,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template static bool - _M_not_empty_function(const function<_Signature>& __f) + _M_not_empty_function(const function<_Signature>& __f) noexcept { return static_cast(__f); } template static bool - _M_not_empty_function(_Tp* __fp) + _M_not_empty_function(_Tp* __fp) noexcept { return __fp != nullptr; } template static bool - _M_not_empty_function(_Tp _Class::* __mp) + _M_not_empty_function(_Tp _Class::* __mp) noexcept { return __mp != nullptr; } template static bool - _M_not_empty_function(const _Tp&) + _M_not_empty_function(const _Tp&) noexcept { return true; } };