Remove uses of BOOST_SP_NOEXCEPT from sp_counted_base_std_atomic.hpp

This commit is contained in:
Peter Dimov
2024-10-02 21:58:26 +03:00
parent d77c27986e
commit df366326e1

View File

@@ -16,7 +16,6 @@
// http://www.boost.org/LICENSE_1_0.txt // http://www.boost.org/LICENSE_1_0.txt
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
@@ -34,17 +33,17 @@ namespace boost
namespace detail namespace detail
{ {
inline void atomic_increment( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT inline void atomic_increment( std::atomic_int_least32_t * pw ) noexcept
{ {
pw->fetch_add( 1, std::memory_order_relaxed ); pw->fetch_add( 1, std::memory_order_relaxed );
} }
inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) noexcept
{ {
return pw->fetch_sub( 1, std::memory_order_acq_rel ); return pw->fetch_sub( 1, std::memory_order_acq_rel );
} }
inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) noexcept
{ {
// long r = *pw; // long r = *pw;
// if( r != 0 ) ++*pw; // if( r != 0 ) ++*pw;
@@ -78,41 +77,41 @@ private:
public: public:
sp_counted_base() BOOST_SP_NOEXCEPT: use_count_( 1 ), weak_count_( 1 ) sp_counted_base() noexcept: use_count_( 1 ), weak_count_( 1 )
{ {
} }
virtual ~sp_counted_base() /*BOOST_SP_NOEXCEPT*/ virtual ~sp_counted_base() /*noexcept*/
{ {
} }
// dispose() is called when use_count_ drops to zero, to release // dispose() is called when use_count_ drops to zero, to release
// the resources managed by *this. // the resources managed by *this.
virtual void dispose() BOOST_SP_NOEXCEPT = 0; virtual void dispose() noexcept = 0;
// destroy() is called when weak_count_ drops to zero. // destroy() is called when weak_count_ drops to zero.
virtual void destroy() BOOST_SP_NOEXCEPT virtual void destroy() noexcept
{ {
delete this; delete this;
} }
virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; virtual void * get_deleter( sp_typeinfo_ const & ti ) noexcept = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; virtual void * get_local_deleter( sp_typeinfo_ const & ti ) noexcept = 0;
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; virtual void * get_untyped_deleter() noexcept = 0;
void add_ref_copy() BOOST_SP_NOEXCEPT void add_ref_copy() noexcept
{ {
atomic_increment( &use_count_ ); atomic_increment( &use_count_ );
} }
bool add_ref_lock() BOOST_SP_NOEXCEPT // true on success bool add_ref_lock() noexcept // true on success
{ {
return atomic_conditional_increment( &use_count_ ) != 0; return atomic_conditional_increment( &use_count_ ) != 0;
} }
void release() BOOST_SP_NOEXCEPT void release() noexcept
{ {
if( atomic_decrement( &use_count_ ) == 1 ) if( atomic_decrement( &use_count_ ) == 1 )
{ {
@@ -121,12 +120,12 @@ public:
} }
} }
void weak_add_ref() BOOST_SP_NOEXCEPT void weak_add_ref() noexcept
{ {
atomic_increment( &weak_count_ ); atomic_increment( &weak_count_ );
} }
void weak_release() BOOST_SP_NOEXCEPT void weak_release() noexcept
{ {
if( atomic_decrement( &weak_count_ ) == 1 ) if( atomic_decrement( &weak_count_ ) == 1 )
{ {
@@ -134,7 +133,7 @@ public:
} }
} }
long use_count() const BOOST_SP_NOEXCEPT long use_count() const noexcept
{ {
return use_count_.load( std::memory_order_acquire ); return use_count_.load( std::memory_order_acquire );
} }