Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81318 - trunk/boost/lockfree/detail
From: tim_at_[hidden]
Date: 2012-11-13 05:59:46


Author: timblechmann
Date: 2012-11-13 05:59:45 EST (Tue, 13 Nov 2012)
New Revision: 81318
URL: http://svn.boost.org/trac/boost/changeset/81318

Log:
lockfree: allow use of std::atomic when using gcc-4.8

Signed-off-by: Tim Blechmann <tim_at_[hidden]>
Text files modified:
   trunk/boost/lockfree/detail/atomic.hpp | 26 +++++++++++++++++++++++---
   1 files changed, 23 insertions(+), 3 deletions(-)

Modified: trunk/boost/lockfree/detail/atomic.hpp
==============================================================================
--- trunk/boost/lockfree/detail/atomic.hpp (original)
+++ trunk/boost/lockfree/detail/atomic.hpp 2012-11-13 05:59:45 EST (Tue, 13 Nov 2012)
@@ -9,12 +9,32 @@
 
 #include <boost/config.hpp>
 
-// at this time, neither gcc (4.7) not clang (3.2) completely implement atomic<>
-// MSVC has it from version 2012 onwards.
-#if !defined(_MSC_VER) || _MSC_VER < 1700
+// at this time, few compiles completely implement atomic<>
 #define BOOST_LOCKFREE_NO_HDR_ATOMIC
+
+// MSVC supports atomic<> from version 2012 onwards.
+#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
+#undef BOOST_LOCKFREE_NO_HDR_ATOMIC
+#endif
+
+// GCC supports atomic<> from version 4.8 onwards.
+#if defined(__GNUC__)
+# if defined(__GNUC_PATCHLEVEL__)
+# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+# else
+# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100)
+# endif
 #endif
 
+#if (__GNUC_VERSION__ >= 40800) && (__cplusplus >= 201103L)
+#undef BOOST_LOCKFREE_NO_HDR_ATOMIC
+#endif
+
+#undef __GNUC_VERSION__
+
 #if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC)
 #include <boost/atomic.hpp>
 #else


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