summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-04-11 18:19:17 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-04-11 19:20:07 (GMT)
commit857e44c156a1dbefcb49bb5792c4384cebd8762a (patch)
tree11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/smart_ptr
parent77d4eb7588e113beaa03f3347523b26adefdeb06 (diff)
downloadswift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip
swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/smart_ptr')
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/lwm_pthreads.hpp11
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/quick_allocator.hpp5
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp14
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/sp_convertible.hpp4
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp6
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp2
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp19
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp15
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp56
9 files changed, 111 insertions, 21 deletions
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/lwm_pthreads.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/lwm_pthreads.hpp
index fc20dbb..8eda518 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/detail/lwm_pthreads.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/detail/lwm_pthreads.hpp
@@ -17,6 +17,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
+#include <boost/assert.hpp>
#include <pthread.h>
namespace boost
@@ -42,15 +43,15 @@ public:
// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
#if defined(__hpux) && defined(_DECTHREADS_)
- pthread_mutex_init(&m_, pthread_mutexattr_default);
+ BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 );
#else
- pthread_mutex_init(&m_, 0);
+ BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 );
#endif
}
~lightweight_mutex()
{
- pthread_mutex_destroy(&m_);
+ BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 );
}
class scoped_lock;
@@ -69,12 +70,12 @@ public:
scoped_lock(lightweight_mutex & m): m_(m.m_)
{
- pthread_mutex_lock(&m_);
+ BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
}
~scoped_lock()
{
- pthread_mutex_unlock(&m_);
+ BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
}
};
};
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/quick_allocator.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/quick_allocator.hpp
index 6d136f8..159bd5e 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/detail/quick_allocator.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/detail/quick_allocator.hpp
@@ -74,8 +74,9 @@ template<unsigned size, unsigned align_> struct allocator_impl
static lightweight_mutex & mutex()
{
- static lightweight_mutex m;
- return m;
+ static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm;
+ static lightweight_mutex * pm = new( &fbm ) lightweight_mutex;
+ return *pm;
}
static lightweight_mutex * mutex_init;
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp
index b968bba..4943e37 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp
@@ -333,6 +333,20 @@ public:
if(pi_ != 0) pi_->weak_add_ref();
}
+// Move support
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ weak_count(weak_count && r): pi_(r.pi_) // nothrow
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(weak_count_id)
+#endif
+ {
+ r.pi_ = 0;
+ }
+
+#endif
+
~weak_count() // nothrow
{
if(pi_ != 0) pi_->weak_release();
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_convertible.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_convertible.hpp
index 7d9502d..b7f0ea8 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_convertible.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_convertible.hpp
@@ -25,7 +25,7 @@
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x610 )
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x620 )
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
@@ -45,7 +45,7 @@ template< class Y, class T > struct sp_convertible
static yes f( T* );
static no f( ... );
- enum _vt { value = sizeof( f( (Y*)0 ) ) == sizeof(yes) };
+ enum _vt { value = sizeof( f( static_cast<Y*>(0) ) ) == sizeof(yes) };
};
struct sp_empty
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
index 8af6f0a..21fa59d 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
@@ -30,9 +30,9 @@ namespace detail
inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ )
{
- __asm__ __volatile__( "cas %0, %2, %1"
- : "+m" (*dest_), "+r" (swap_)
- : "r" (compare_)
+ __asm__ __volatile__( "cas [%1], %2, %0"
+ : "+r" (swap_)
+ : "r" (dest_), "r" (compare_)
: "memory" );
return swap_;
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp
index cb0282d..7fcd09e 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp
@@ -40,7 +40,7 @@
#undef BOOST_SP_HAS_SYNC
#endif
-#if defined( __INTEL_COMPILER ) && !defined( __ia64__ )
+#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1100 )
#undef BOOST_SP_HAS_SYNC
#endif
diff --git a/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp
index d3bd02b..e72eb21 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp
@@ -77,7 +77,7 @@ public:
template<class U>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
- intrusive_ptr( intrusive_ptr<U> const & rhs, typename detail::sp_enable_if_convertible<U,T>::type = detail::sp_empty() )
+ intrusive_ptr( intrusive_ptr<U> const & rhs, typename boost::detail::sp_enable_if_convertible<U,T>::type = boost::detail::sp_empty() )
#else
@@ -111,6 +111,23 @@ public:
#endif
+// Move support
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ intrusive_ptr(intrusive_ptr && rhs): px( rhs.px )
+ {
+ rhs.px = 0;
+ }
+
+ intrusive_ptr & operator=(intrusive_ptr && rhs)
+ {
+ this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this);
+ return *this;
+ }
+
+#endif
+
intrusive_ptr & operator=(intrusive_ptr const & rhs)
{
this_type(rhs).swap(*this);
diff --git a/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp
index 7f46c35..609cce9 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp
@@ -61,6 +61,7 @@ namespace boost
template<class T> class shared_ptr;
template<class T> class weak_ptr;
template<class T> class enable_shared_from_this;
+template<class T> class enable_shared_from_this2;
namespace detail
{
@@ -109,6 +110,14 @@ template< class X, class Y, class T > inline void sp_enable_shared_from_this( bo
}
}
+template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> * ppx, Y const * py, boost::enable_shared_from_this2< T > const * pe )
+{
+ if( pe != 0 )
+ {
+ pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) );
+ }
+}
+
#ifdef _MANAGED
// Avoid C4793, ... causes native code generation
@@ -219,7 +228,7 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
- shared_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@@ -344,7 +353,7 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
- shared_ptr( shared_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ shared_ptr( shared_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@@ -439,7 +448,7 @@ public:
return pn < rhs.pn;
}
- void * _internal_get_deleter( detail::sp_typeinfo const & ti ) const
+ void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
{
return pn.get_deleter( ti );
}
diff --git a/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp
index bf5296a..d314b0d 100644
--- a/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp
+++ b/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp
@@ -63,22 +63,54 @@ public:
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
- weak_ptr( weak_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
weak_ptr( weak_ptr<Y> const & r )
#endif
- : pn(r.pn) // never throws
+ : px(r.lock().get()), pn(r.pn) // never throws
{
- px = r.lock().get();
}
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
+
+#else
+
+ weak_ptr( weak_ptr<Y> && r )
+
+#endif
+ : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
+ {
+ r.px = 0;
+ }
+
+ // for better efficiency in the T == Y case
+ weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
+ {
+ r.px = 0;
+ }
+
+ // for better efficiency in the T == Y case
+ weak_ptr & operator=( weak_ptr && r ) // never throws
+ {
+ this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+
+
+#endif
+
template<class Y>
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
- weak_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+ weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
#else
@@ -99,6 +131,17 @@ public:
return *this;
}
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ template<class Y>
+ weak_ptr & operator=( weak_ptr<Y> && r )
+ {
+ this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+
+#endif
+
template<class Y>
weak_ptr & operator=(shared_ptr<Y> const & r) // never throws
{
@@ -124,6 +167,11 @@ public:
return pn.use_count() == 0;
}
+ bool _empty() const // extension, not in std::weak_ptr
+ {
+ return pn.empty();
+ }
+
void reset() // never throws in 1.30+
{
this_type().swap(*this);