Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51517 - trunk/boost/smart_ptr/detail
From: pdimov_at_[hidden]
Date: 2009-03-01 13:01:20


Author: pdimov
Date: 2009-03-01 13:01:19 EST (Sun, 01 Mar 2009)
New Revision: 51517
URL: http://svn.boost.org/trac/boost/changeset/51517

Log:
Refs #2525 (fixed in trunk.)
Added:
   trunk/boost/smart_ptr/detail/sp_has_sync.hpp (contents, props changed)
Text files modified:
   trunk/boost/smart_ptr/detail/atomic_count.hpp | 5 +++--
   trunk/boost/smart_ptr/detail/atomic_count_gcc.hpp | 6 +++++-
   trunk/boost/smart_ptr/detail/sp_counted_base.hpp | 5 +++--
   trunk/boost/smart_ptr/detail/spinlock.hpp | 8 +++++++-
   4 files changed, 18 insertions(+), 6 deletions(-)

Modified: trunk/boost/smart_ptr/detail/atomic_count.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/atomic_count.hpp (original)
+++ trunk/boost/smart_ptr/detail/atomic_count.hpp 2009-03-01 13:01:19 EST (Sun, 01 Mar 2009)
@@ -74,6 +74,7 @@
 //
 
 #include <boost/config.hpp>
+#include <boost/smart_ptr/detail/sp_has_sync.hpp>
 
 #ifndef BOOST_HAS_THREADS
 
@@ -95,10 +96,10 @@
 #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
 # include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp>
 
-#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
+#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 # include <boost/smart_ptr/detail/atomic_count_win32.hpp>
 
-#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) )
+#elif defined( BOOST_SP_HAS_SYNC )
 # include <boost/smart_ptr/detail/atomic_count_sync.hpp>
 
 #elif defined(__GLIBCPP__) || defined(__GLIBCXX__)

Modified: trunk/boost/smart_ptr/detail/atomic_count_gcc.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/atomic_count_gcc.hpp (original)
+++ trunk/boost/smart_ptr/detail/atomic_count_gcc.hpp 2009-03-01 13:01:19 EST (Sun, 01 Mar 2009)
@@ -17,7 +17,11 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include <bits/atomicity.h>
+#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402
+# include <ext/atomicity.h>
+#else
+# include <bits/atomicity.h>
+#endif
 
 namespace boost
 {

Modified: trunk/boost/smart_ptr/detail/sp_counted_base.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/sp_counted_base.hpp (original)
+++ trunk/boost/smart_ptr/detail/sp_counted_base.hpp 2009-03-01 13:01:19 EST (Sun, 01 Mar 2009)
@@ -18,6 +18,7 @@
 //
 
 #include <boost/config.hpp>
+#include <boost/smart_ptr/detail/sp_has_sync.hpp>
 
 #if defined( BOOST_SP_DISABLE_THREADS )
 # include <boost/smart_ptr/detail/sp_counted_base_nt.hpp>
@@ -46,13 +47,13 @@
 #elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) )
 # include <boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp>
 
-#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) )
+#elif defined( BOOST_SP_HAS_SYNC )
 # include <boost/smart_ptr/detail/sp_counted_base_sync.hpp>
 
 #elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) )
 # include <boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp>
 
-#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__)
 # include <boost/smart_ptr/detail/sp_counted_base_w32.hpp>
 
 #elif !defined( BOOST_HAS_THREADS )

Added: trunk/boost/smart_ptr/detail/sp_has_sync.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/smart_ptr/detail/sp_has_sync.hpp 2009-03-01 13:01:19 EST (Sun, 01 Mar 2009)
@@ -0,0 +1,49 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// boost/smart_ptr/detail/sp_has_sync.hpp
+//
+// Copyright (c) 2008, 2009 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics
+// are available.
+//
+
+#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
+
+#define BOOST_SP_HAS_SYNC
+
+#if defined( __arm__ ) || defined( __armel__ )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
+#if defined( __hppa ) || defined( __hppa__ )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
+#if defined( __m68k__ )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
+#if defined( __sparc__ )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
+#if defined( __INTEL_COMPILER ) && !defined( __ia64__ )
+#undef BOOST_SP_HAS_SYNC
+#endif
+
+#endif // __GNUC__ * 100 + __GNUC_MINOR__ >= 401
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED

Modified: trunk/boost/smart_ptr/detail/spinlock.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/spinlock.hpp (original)
+++ trunk/boost/smart_ptr/detail/spinlock.hpp 2009-03-01 13:01:19 EST (Sun, 01 Mar 2009)
@@ -29,17 +29,23 @@
 //
 
 #include <boost/config.hpp>
+#include <boost/smart_ptr/detail/sp_has_sync.hpp>
 
 #if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
 # include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp>
-#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) )
+
+#elif defined( BOOST_SP_HAS_SYNC )
 # include <boost/smart_ptr/detail/spinlock_sync.hpp>
+
 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 # include <boost/smart_ptr/detail/spinlock_w32.hpp>
+
 #elif defined(BOOST_HAS_PTHREADS)
 # include <boost/smart_ptr/detail/spinlock_pt.hpp>
+
 #elif !defined(BOOST_HAS_THREADS)
 # include <boost/smart_ptr/detail/spinlock_nt.hpp>
+
 #else
 # error Unrecognized threading platform
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk