From 7c01e640f7b2a68579e3410cf65d48f2ba655eca Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 7 Jun 2020 06:05:17 +0300 Subject: [PATCH] Use int_least32_t in atomic_count_sync; prefer it to atomic_count_gcc_x86; mark latter obsolete --- include/boost/smart_ptr/detail/atomic_count.hpp | 6 +++--- include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp | 4 ++++ include/boost/smart_ptr/detail/atomic_count_sync.hpp | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/boost/smart_ptr/detail/atomic_count.hpp b/include/boost/smart_ptr/detail/atomic_count.hpp index e0cbe26..456b2db 100644 --- a/include/boost/smart_ptr/detail/atomic_count.hpp +++ b/include/boost/smart_ptr/detail/atomic_count.hpp @@ -76,12 +76,12 @@ #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) # include -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ ) -# include - #elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) # include +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ ) +# include + #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # include diff --git a/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp b/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp index 100c9cf..30a73e3 100644 --- a/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +++ b/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp @@ -13,6 +13,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include + #if defined(BOOST_SP_REPORT_IMPLEMENTATION) #include @@ -20,6 +22,8 @@ BOOST_PRAGMA_MESSAGE("Using g++/x86 atomic_count") #endif +BOOST_SP_OBSOLETE() + namespace boost { diff --git a/include/boost/smart_ptr/detail/atomic_count_sync.hpp b/include/boost/smart_ptr/detail/atomic_count_sync.hpp index 81d7d65..c65d1e9 100644 --- a/include/boost/smart_ptr/detail/atomic_count_sync.hpp +++ b/include/boost/smart_ptr/detail/atomic_count_sync.hpp @@ -15,6 +15,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include + #if defined( __ia64__ ) && defined( __INTEL_COMPILER ) # include #endif @@ -36,7 +38,9 @@ class atomic_count { public: - explicit atomic_count( long v ) : value_( v ) {} + explicit atomic_count( long v ) : value_( static_cast< boost::int_least32_t >( v ) ) + { + } long operator++() { @@ -58,7 +62,7 @@ private: atomic_count(atomic_count const &); atomic_count & operator=(atomic_count const &); - mutable long value_; + mutable boost::int_least32_t value_; }; } // namespace detail