From d28b0d07fc6a472587d6fb9e1515b4d1c241f45e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 16 Jul 2014 15:24:17 +0300 Subject: [PATCH 1/6] Revert "Fix warnings on gcc 4.4" This reverts commit b1beb11a453c7e4acec7dc6743144b2af3393c76. --- include/boost/smart_ptr/detail/sp_forward.hpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/boost/smart_ptr/detail/sp_forward.hpp b/include/boost/smart_ptr/detail/sp_forward.hpp index 3372665..5f1d190 100644 --- a/include/boost/smart_ptr/detail/sp_forward.hpp +++ b/include/boost/smart_ptr/detail/sp_forward.hpp @@ -25,17 +25,6 @@ namespace detail #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -#if defined( __GNUC__ ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 - -// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. -// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. -template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT -{ - return t; -} - -#else - template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT { return static_cast< T&& >( t ); @@ -43,8 +32,6 @@ template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT #endif -#endif - } // namespace detail } // namespace boost From 0bab2cc658c9caa25566e9b02e1c46fdd6ee258c Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 25 Jul 2014 20:33:29 -0700 Subject: [PATCH 2/6] Rename member because _CRTDBG_MAP_ALLOC in VS does not allow it _CRTDBG_MAP_ALLOC has issues with member functions named "free". --- include/boost/smart_ptr/detail/array_allocator.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/smart_ptr/detail/array_allocator.hpp b/include/boost/smart_ptr/detail/array_allocator.hpp index fb8e662..4f9dc2b 100644 --- a/include/boost/smart_ptr/detail/array_allocator.hpp +++ b/include/boost/smart_ptr/detail/array_allocator.hpp @@ -166,12 +166,12 @@ namespace boost { void operator()() { if (data.object) { R tag; - free(tag); + release(tag); } } private: - void free(ms_init_tag) { + void release(ms_init_tag) { #if !defined(BOOST_NO_CXX11_ALLOCATOR) as_destroy(allocator(), data.object, data.size); #else @@ -179,7 +179,7 @@ namespace boost { #endif } - void free(ms_noinit_tag) { + void release(ms_noinit_tag) { ms_destroy(data.object, data.size); } From 59ac922a1c9dbdb272c97ecd919df954e75e9459 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 8 Aug 2014 16:02:08 +0300 Subject: [PATCH 3/6] Revert "Revert "Fix warnings on gcc 4.4"" This reverts commit d28b0d07fc6a472587d6fb9e1515b4d1c241f45e. --- include/boost/smart_ptr/detail/sp_forward.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/boost/smart_ptr/detail/sp_forward.hpp b/include/boost/smart_ptr/detail/sp_forward.hpp index 5f1d190..3372665 100644 --- a/include/boost/smart_ptr/detail/sp_forward.hpp +++ b/include/boost/smart_ptr/detail/sp_forward.hpp @@ -25,6 +25,17 @@ namespace detail #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) +#if defined( __GNUC__ ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 + +// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. +// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. +template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT +{ + return t; +} + +#else + template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT { return static_cast< T&& >( t ); @@ -32,6 +43,8 @@ template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT #endif +#endif + } // namespace detail } // namespace boost From 280aadfcdb65a5de2313d8b328a48d5920fdb838 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 16 Jul 2014 16:43:35 +0400 Subject: [PATCH 4/6] Fix compilation problems with clang Apparently, clang presents itself as gcc 4.2 even though it supports the final version of rvalue references. Restrict the workaround to gcc only. --- include/boost/smart_ptr/detail/sp_forward.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/smart_ptr/detail/sp_forward.hpp b/include/boost/smart_ptr/detail/sp_forward.hpp index 3372665..8fdec65 100644 --- a/include/boost/smart_ptr/detail/sp_forward.hpp +++ b/include/boost/smart_ptr/detail/sp_forward.hpp @@ -25,7 +25,7 @@ namespace detail #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -#if defined( __GNUC__ ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 +#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 // GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. // This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. From 553c7994ba61b6a4cb5f9588349bf318d8b4a923 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Wed, 30 Jul 2014 09:23:21 -0500 Subject: [PATCH 5/6] Avoid potential conflict between AIX's and Lambda's var. In ../boost/lambda/detail/lambda_functor_base.hpp there is variable called var that conflicts with an AIX system variable. The entire file (sched.h) does not need to be included only the one function it uses (sched_yield). --- include/boost/smart_ptr/detail/yield_k.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/boost/smart_ptr/detail/yield_k.hpp b/include/boost/smart_ptr/detail/yield_k.hpp index 9f4496b..2dabc9f 100644 --- a/include/boost/smart_ptr/detail/yield_k.hpp +++ b/include/boost/smart_ptr/detail/yield_k.hpp @@ -98,7 +98,13 @@ inline void yield( unsigned k ) #elif defined( BOOST_HAS_PTHREADS ) +#ifndef _AIX #include +#else + // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var + extern "C" int sched_yield(void); +#endif + #include namespace boost From 334654de06fb38a5d89a303966d106b9cfce54f2 Mon Sep 17 00:00:00 2001 From: Jonathan Wang Date: Sun, 15 Mar 2015 20:17:55 -0400 Subject: [PATCH 6/6] intrusive_ptr: add converting ctor for intrusive_ptr with move semantics. Analagous to template intrusive_ptr(intrusive_ptr const&) --- include/boost/smart_ptr/intrusive_ptr.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/boost/smart_ptr/intrusive_ptr.hpp b/include/boost/smart_ptr/intrusive_ptr.hpp index e5db609..0b02eba 100644 --- a/include/boost/smart_ptr/intrusive_ptr.hpp +++ b/include/boost/smart_ptr/intrusive_ptr.hpp @@ -122,6 +122,20 @@ public: return *this; } +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + template friend class intrusive_ptr; + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + intrusive_ptr(intrusive_ptr && rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty()) +#else + intrusive_ptr(intrusive_ptr && rhs) +#endif + : px( rhs.px ) + { + rhs.px = 0; + } +#endif + #endif intrusive_ptr & operator=(intrusive_ptr const & rhs)