From: Stephan Bergmann Date: Mon, 26 Oct 2020 10:11:50 +0000 (+0000) Subject: libstdc++: Add missing exception-specifications in shared_ptr X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dc7824734e6589bac2ba0f8363d24d50da8cfeae;p=gcc.git libstdc++: Add missing exception-specifications in shared_ptr libstdc++-v3/ChangeLog: * include/bits/shared_ptr_base.h (_Sp_counted_base::_M_add_ref_lock_nothrow(): Add noexcept to definitions to match declaration. (__shared_count(const __weak_count&, nothrow_t)): Add noexcept to declaration to match definition. --- diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index a9e1c9bb1d5..543783ba034 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -227,7 +227,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> inline bool _Sp_counted_base<_S_single>:: - _M_add_ref_lock_nothrow() + _M_add_ref_lock_nothrow() noexcept { if (_M_use_count == 0) return false; @@ -238,7 +238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> inline bool _Sp_counted_base<_S_mutex>:: - _M_add_ref_lock_nothrow() + _M_add_ref_lock_nothrow() noexcept { __gnu_cxx::__scoped_lock sentry(*this); if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) @@ -252,7 +252,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> inline bool _Sp_counted_base<_S_atomic>:: - _M_add_ref_lock_nothrow() + _M_add_ref_lock_nothrow() noexcept { // Perform lock-free add-if-not-zero operation. _Atomic_word __count = _M_get_use_count(); @@ -693,7 +693,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit __shared_count(const __weak_count<_Lp>& __r); // Does not throw if __r._M_get_use_count() == 0, caller must check. - explicit __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t); + explicit + __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t) noexcept; ~__shared_count() noexcept {