[gcc r11-4374] libstdc++: Add missing exception-specifications in shared_ptr

Jonathan Wakely redi@gcc.gnu.org
Mon Oct 26 10:16:04 GMT 2020


https://gcc.gnu.org/g:dc7824734e6589bac2ba0f8363d24d50da8cfeae

commit r11-4374-gdc7824734e6589bac2ba0f8363d24d50da8cfeae
Author: Stephan Bergmann <sbergman@redhat.com>
Date:   Mon Oct 26 10:11:50 2020 +0000

    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:
---
 libstdc++-v3/include/bits/shared_ptr_base.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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
       {


More information about the Libstdc++-cvs mailing list