From df366326e1dd563643b25a1a8e99b6c9bed793c6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 2 Oct 2024 21:58:26 +0300 Subject: [PATCH] Remove uses of BOOST_SP_NOEXCEPT from sp_counted_base_std_atomic.hpp --- .../detail/sp_counted_base_std_atomic.hpp | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp index 52acf92..7237f1e 100644 --- a/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +++ b/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp @@ -16,7 +16,6 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#include #include #include #include @@ -34,17 +33,17 @@ namespace boost 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 ); } -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 ); } -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; // if( r != 0 ) ++*pw; @@ -78,41 +77,41 @@ private: 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 // 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. - virtual void destroy() BOOST_SP_NOEXCEPT + virtual void destroy() noexcept { delete this; } - virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; - virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; - virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) noexcept = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) 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_ ); } - 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; } - void release() BOOST_SP_NOEXCEPT + void release() noexcept { 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_ ); } - void weak_release() BOOST_SP_NOEXCEPT + void weak_release() noexcept { 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 ); }