Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83096 - in trunk/boost/atomic: . detail
From: andrey.semashev_at_[hidden]
Date: 2013-02-23 09:21:21


Author: andysem
Date: 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
New Revision: 83096
URL: http://svn.boost.org/trac/boost/changeset/83096

Log:
1. Fixed compilation with MSVC 2003.
2. Fixed incorrect reinterpret_casts in constexpr constructors that could result in buffer overruns. The initializing constructors for non-integral atomics are not constexpr yet because memcpy must be used inside.
3. Made atomic_flag default constructors constexpr. This is not by the standard but we do not implement ATOMIC_FLAG_INIT yet, so the default constructor is needed and it should be constexpr when possible.
4. Fixed a few syntax errors and cleaned up the code a bit.
5. Moved operator value_type() to the interface class in order not to duplicate it in base_atomic specializations.
6. The return type of operator=() changed to follow the standard.
Text files modified:
   trunk/boost/atomic/atomic.hpp | 43 +++++++++++++++--
   trunk/boost/atomic/detail/base.hpp | 37 +++++----------
   trunk/boost/atomic/detail/cas32strong.hpp | 55 +++++++++++++---------
   trunk/boost/atomic/detail/cas32weak.hpp | 58 +++++++++++++++---------
   trunk/boost/atomic/detail/cas64strong.hpp | 29 +++++++-----
   trunk/boost/atomic/detail/gcc-alpha.hpp | 22 ++++++--
   trunk/boost/atomic/detail/gcc-armv6plus.hpp | 5 +
   trunk/boost/atomic/detail/gcc-cas.hpp | 5 +
   trunk/boost/atomic/detail/gcc-ppc.hpp | 95 ++++++++++++++++++++++++----------------
   trunk/boost/atomic/detail/gcc-sparcv9.hpp | 65 ++++++++++++++++-----------
   trunk/boost/atomic/detail/gcc-x86.hpp | 76 ++++++++++++++++++-------------
   trunk/boost/atomic/detail/generic-cas.hpp | 15 ++++-
   trunk/boost/atomic/detail/interlocked.hpp | 24 +++------
   trunk/boost/atomic/detail/linux-arm.hpp | 5 +
   trunk/boost/atomic/detail/windows.hpp | 85 +++++++++++++++++++++++------------
   15 files changed, 376 insertions(+), 243 deletions(-)

Modified: trunk/boost/atomic/atomic.hpp
==============================================================================
--- trunk/boost/atomic/atomic.hpp (original)
+++ trunk/boost/atomic/atomic.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -17,6 +17,10 @@
 #include <boost/atomic/detail/platform.hpp>
 #include <boost/atomic/detail/type-classification.hpp>
 #include <boost/type_traits/is_signed.hpp>
+#if defined(BOOST_MSVC) && BOOST_MSVC < 1400
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/mpl/and.hpp>
+#endif
 
 #ifdef BOOST_ATOMIC_HAS_PRAGMA_ONCE
 #pragma once
@@ -83,23 +87,48 @@
 
 template<typename T>
 class atomic :
- public atomics::detail::base_atomic<T, typename atomics::detail::classify<T>::type, atomics::detail::storage_size_of<T>::value, boost::is_signed<T>::value >
+ public atomics::detail::base_atomic<
+ T,
+ typename atomics::detail::classify<T>::type,
+ atomics::detail::storage_size_of<T>::value,
+#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1400
+ boost::is_signed<T>::value
+#else
+ // MSVC 2003 has problems instantiating is_signed on non-itegral types
+ mpl::and_< boost::is_integral<T>, boost::is_signed<T> >::value
+#endif
+ >
 {
 private:
     typedef T value_type;
- typedef atomics::detail::base_atomic<T, typename atomics::detail::classify<T>::type, atomics::detail::storage_size_of<T>::value, boost::is_signed<T>::value > super;
+ typedef atomics::detail::base_atomic<
+ T,
+ typename atomics::detail::classify<T>::type,
+ atomics::detail::storage_size_of<T>::value,
+#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1400
+ boost::is_signed<T>::value
+#else
+ // MSVC 2003 has problems instantiating is_signed on non-itegral types
+ mpl::and_< boost::is_integral<T>, boost::is_signed<T> >::value
+#endif
+ > super;
 public:
     atomic(void) BOOST_NOEXCEPT : super() {}
- BOOST_CONSTEXPR atomic(value_type v) BOOST_NOEXCEPT: super(v) {}
+ BOOST_CONSTEXPR atomic(value_type v) BOOST_NOEXCEPT : super(v) {}
 
- atomic & operator=(value_type v) volatile BOOST_NOEXCEPT
+ value_type operator=(value_type v) volatile BOOST_NOEXCEPT
     {
- super::operator=(v);
- return *const_cast<atomic *>(this);
+ this->store(v);
+ return v;
+ }
+
+ operator value_type(void) volatile const BOOST_NOEXCEPT
+ {
+ return this->load();
     }
 
-private:
 #ifdef BOOST_NO_CXX11_DELETED_FUNCTIONS
+private:
     atomic(const atomic &) /* =delete */ ;
     atomic & operator=(const atomic &) volatile /* =delete */ ;
 #else

Modified: trunk/boost/atomic/detail/base.hpp
==============================================================================
--- trunk/boost/atomic/detail/base.hpp (original)
+++ trunk/boost/atomic/detail/base.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -24,18 +24,6 @@
 #endif
 
 #define BOOST_ATOMIC_DECLARE_BASE_OPERATORS \
- operator value_type(void) volatile const BOOST_NOEXCEPT \
- { \
- return load(memory_order_seq_cst); \
- } \
- \
- this_type & \
- operator=(value_type v) volatile BOOST_NOEXCEPT \
- { \
- store(v, memory_order_seq_cst); \
- return *const_cast<this_type *>(this); \
- } \
- \
     bool \
     compare_exchange_strong( \
         value_type & expected, \
@@ -53,7 +41,6 @@
     { \
         return compare_exchange_weak(expected, desired, order, calculate_failure_order(order)); \
     } \
- \
 
 #define BOOST_ATOMIC_DECLARE_ADDITIVE_OPERATORS \
     value_type \
@@ -138,7 +125,8 @@
 }
 
 template<typename T, typename C, unsigned int Size, bool Sign>
-class base_atomic {
+class base_atomic
+{
 private:
     typedef base_atomic this_type;
     typedef T value_type;
@@ -148,8 +136,7 @@
 public:
     base_atomic(void) {}
 
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT:
- v_(v)
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(v)
     {}
 
     void
@@ -224,8 +211,7 @@
 private:
     char * storage_ptr() volatile const BOOST_NOEXCEPT
     {
- const char volatile * ptr = reinterpret_cast<const char volatile *>(&v_);
- return const_cast<char *>(ptr);
+ return const_cast<char *>(&reinterpret_cast<char const volatile &>(v_));
     }
 
     base_atomic(const base_atomic &) /* = delete */ ;
@@ -235,14 +221,15 @@
 };
 
 template<typename T, unsigned int Size, bool Sign>
-class base_atomic<T, int, Size, Sign> {
+class base_atomic<T, int, Size, Sign>
+{
 private:
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef lockpool::scoped_lock guard_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -360,14 +347,15 @@
 };
 
 template<typename T, unsigned int Size, bool Sign>
-class base_atomic<T *, void *, Size, Sign> {
+class base_atomic<T *, void *, Size, Sign>
+{
 private:
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
     typedef lockpool::scoped_lock guard_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -452,13 +440,14 @@
 };
 
 template<unsigned int Size, bool Sign>
-class base_atomic<void *, void *, Size, Sign> {
+class base_atomic<void *, void *, Size, Sign>
+{
 private:
     typedef base_atomic this_type;
     typedef void * value_type;
     typedef lockpool::scoped_lock guard_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void

Modified: trunk/boost/atomic/detail/cas32strong.hpp
==============================================================================
--- trunk/boost/atomic/detail/cas32strong.hpp (original)
+++ trunk/boost/atomic/detail/cas32strong.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -29,13 +29,14 @@
 /* integral types */
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 1, Sign> {
+class base_atomic<T, int, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -156,13 +157,14 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 2, Sign> {
+class base_atomic<T, int, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -283,12 +285,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 4, Sign> {
+class base_atomic<T, int, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -407,12 +410,13 @@
 /* pointer types */
 
 template<bool Sign>
-class base_atomic<void *, void *, 4, Sign> {
+class base_atomic<void *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -502,12 +506,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 4, Sign> {
+class base_atomic<T *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -599,14 +604,16 @@
 /* generic types */
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 1, Sign> {
+class base_atomic<T, void, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
 
     base_atomic(void) {}
 
@@ -688,14 +695,16 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 2, Sign> {
+class base_atomic<T, void, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
 
     base_atomic(void) {}
 
@@ -778,14 +787,16 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 4, Sign> {
+class base_atomic<T, void, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
 
     base_atomic(void) {}
 

Modified: trunk/boost/atomic/detail/cas32weak.hpp
==============================================================================
--- trunk/boost/atomic/detail/cas32weak.hpp (original)
+++ trunk/boost/atomic/detail/cas32weak.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -26,13 +26,14 @@
 /* integral types */
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 1, Sign> {
+class base_atomic<T, int, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -161,13 +162,14 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 2, Sign> {
+class base_atomic<T, int, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -296,12 +298,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 4, Sign> {
+class base_atomic<T, int, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -428,12 +431,13 @@
 /* pointer types */
 
 template<bool Sign>
-class base_atomic<void *, void *, 4, Sign> {
+class base_atomic<void *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -513,12 +517,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 4, Sign> {
+class base_atomic<T *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -618,14 +623,17 @@
 /* generic types */
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 1, Sign> {
+class base_atomic<T, void, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+
     base_atomic(void) {}
 
     void
@@ -715,14 +723,17 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 2, Sign> {
+class base_atomic<T, void, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+
     base_atomic(void) {}
 
     void
@@ -812,14 +823,17 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 4, Sign> {
+class base_atomic<T, void, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+
     base_atomic(void) {}
 
     void

Modified: trunk/boost/atomic/detail/cas64strong.hpp
==============================================================================
--- trunk/boost/atomic/detail/cas64strong.hpp (original)
+++ trunk/boost/atomic/detail/cas64strong.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -29,12 +29,13 @@
 /* integral types */
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 8, Sign> {
+class base_atomic<T, int, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -153,12 +154,13 @@
 /* pointer types */
 
 template<bool Sign>
-class base_atomic<void *, void *, 8, Sign> {
+class base_atomic<void *, void *, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -248,12 +250,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 8, Sign> {
+class base_atomic<T *, void *, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -345,21 +348,23 @@
 /* generic types */
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 8, Sign> {
+class base_atomic<T, void, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint64_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
     base_atomic(void) {}
 
     void
     store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
     {
         storage_type value_s = 0;
- memcpy(&value_s, &value, sizeof(value_s));
+ memcpy(&value_s, &value, sizeof(value_type));
         platform_fence_before_store(order);
         platform_store64(value_s, &v_);
         platform_fence_after_store(order);
@@ -371,7 +376,7 @@
         storage_type value_s = platform_load64(&v_);
         platform_fence_after_load(order);
         value_type value;
- memcpy(&value, &value_s, sizeof(value_s));
+ memcpy(&value, &value_s, sizeof(value_type));
         return value;
     }
 

Modified: trunk/boost/atomic/detail/gcc-alpha.hpp
==============================================================================
--- trunk/boost/atomic/detail/gcc-alpha.hpp (original)
+++ trunk/boost/atomic/detail/gcc-alpha.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -88,7 +88,8 @@
 }
 
 template<typename T>
-class atomic_alpha_32 {
+class atomic_alpha_32
+{
 public:
     typedef T integral_type;
     BOOST_CONSTEXPR atomic_alpha_32(T v) BOOST_NOEXCEPT: i(v) {}
@@ -204,7 +205,8 @@
 };
 
 template<typename T>
-class atomic_alpha_64 {
+class atomic_alpha_64
+{
 public:
     typedef T integral_type;
     BOOST_CONSTEXPR atomic_alpha_64(T v) BOOST_NOEXCEPT: i(v) {}
@@ -320,7 +322,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 4> : public build_atomic_from_typical<build_exchange<atomic_alpha_32<T> > > {
+class platform_atomic_integral<T, 4> :
+ public build_atomic_from_typical<build_exchange<atomic_alpha_32<T> > >
+{
 public:
     typedef build_atomic_from_typical<build_exchange<atomic_alpha_32<T> > > super;
     BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
@@ -328,7 +332,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 8> : public build_atomic_from_typical<build_exchange<atomic_alpha_64<T> > > {
+class platform_atomic_integral<T, 8> :
+ public build_atomic_from_typical<build_exchange<atomic_alpha_64<T> > >
+{
 public:
     typedef build_atomic_from_typical<build_exchange<atomic_alpha_64<T> > > super;
     BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
@@ -336,7 +342,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 1>: public build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T> {
+class platform_atomic_integral<T, 1> :
+ public build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T>
+{
 public:
     typedef build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T> super;
     BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}
@@ -344,7 +352,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 2>: public build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T> {
+class platform_atomic_integral<T, 2> :
+ public build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T>
+{
 public:
     typedef build_atomic_from_larger_type<atomic_alpha_32<uint32_t>, T> super;
     BOOST_CONSTEXPR platform_atomic_integral(T v) BOOST_NOEXCEPT: super(v) {}

Modified: trunk/boost/atomic/detail/gcc-armv6plus.hpp
==============================================================================
--- trunk/boost/atomic/detail/gcc-armv6plus.hpp (original)
+++ trunk/boost/atomic/detail/gcc-armv6plus.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -192,13 +192,14 @@
     __asm__ __volatile__ ("" ::: "memory");
 }
 
-class atomic_flag {
+class atomic_flag
+{
 private:
     atomic_flag(const atomic_flag &) /* = delete */ ;
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) BOOST_NOEXCEPT: v_(false) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     void
     clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT

Modified: trunk/boost/atomic/detail/gcc-cas.hpp
==============================================================================
--- trunk/boost/atomic/detail/gcc-cas.hpp (original)
+++ trunk/boost/atomic/detail/gcc-cas.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -102,13 +102,14 @@
     return success;
 }
 
-class atomic_flag {
+class atomic_flag
+{
 private:
     atomic_flag(const atomic_flag &) /* = delete */ ;
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) BOOST_NOEXCEPT: v_(false) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     void
     clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT

Modified: trunk/boost/atomic/detail/gcc-ppc.hpp
==============================================================================
--- trunk/boost/atomic/detail/gcc-ppc.hpp (original)
+++ trunk/boost/atomic/detail/gcc-ppc.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -105,13 +105,14 @@
 }
 }
 
-class atomic_flag {
+class atomic_flag
+{
 private:
     atomic_flag(const atomic_flag &) /* = delete */ ;
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) BOOST_NOEXCEPT: v_(false) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     void
     clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
@@ -196,13 +197,14 @@
 /* integral types */
 
 template<typename T>
-class base_atomic<T, int, 1, true> {
+class base_atomic<T, int, 1, true>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef int32_t storage_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -416,13 +418,14 @@
 };
 
 template<typename T>
-class base_atomic<T, int, 1, false> {
+class base_atomic<T, int, 1, false>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -637,13 +640,14 @@
 };
 
 template<typename T>
-class base_atomic<T, int, 2, true> {
+class base_atomic<T, int, 2, true>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef int32_t storage_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -858,13 +862,14 @@
 };
 
 template<typename T>
-class base_atomic<T, int, 2, false> {
+class base_atomic<T, int, 2, false>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1079,12 +1084,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 4, Sign> {
+class base_atomic<T, int, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1295,12 +1301,13 @@
 #if defined(__powerpc64__)
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 8, Sign> {
+class base_atomic<T, int, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1515,11 +1522,12 @@
 #if !defined(__powerpc64__)
 
 template<bool Sign>
-class base_atomic<void *, void *, 4, Sign> {
+class base_atomic<void *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1643,12 +1651,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 4, Sign> {
+class base_atomic<T *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1812,11 +1821,12 @@
 #else
 
 template<bool Sign>
-class base_atomic<void *, void *, 8, Sign> {
+class base_atomic<void *, void *, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1940,12 +1950,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 8, Sign> {
+class base_atomic<T *, void *, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -2111,14 +2122,16 @@
 /* generic */
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 1, Sign> {
+class base_atomic<T, void, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
     base_atomic(void) {}
 
     void
@@ -2260,14 +2273,16 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 2, Sign> {
+class base_atomic<T, void, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
 
     base_atomic(void) {}
 
@@ -2410,14 +2425,16 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 4, Sign> {
+class base_atomic<T, void, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
 
     base_atomic(void) {}
 
@@ -2562,14 +2579,16 @@
 #if defined(__powerpc64__)
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 8, Sign> {
+class base_atomic<T, void, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint64_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
 
     base_atomic(void) {}
 

Modified: trunk/boost/atomic/detail/gcc-sparcv9.hpp
==============================================================================
--- trunk/boost/atomic/detail/gcc-sparcv9.hpp (original)
+++ trunk/boost/atomic/detail/gcc-sparcv9.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -83,13 +83,14 @@
 }
 }
 
-class atomic_flag {
+class atomic_flag
+{
 private:
     atomic_flag(const atomic_flag &) /* = delete */ ;
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) : v_(false) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     void
     clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
@@ -100,7 +101,7 @@
     }
 
     bool
- test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT BOOST_NOEXCEPT
+ test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
     {
         atomics::detail::platform_fence_before(order);
         uint32_t tmp = 1;
@@ -174,13 +175,14 @@
 /* integral types */
 
 template<typename T>
-class base_atomic<T, int, 1, true> {
+class base_atomic<T, int, 1, true>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef int32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -192,7 +194,7 @@
     }
 
     value_type
- load(memory_order order = memory_order_seq_cst)const volatile BOOST_NOEXCEPT
+ load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
     {
         value_type v = const_cast<const volatile storage_type &>(v_);
         platform_fence_after_load(order);
@@ -296,13 +298,14 @@
 };
 
 template<typename T>
-class base_atomic<T, int, 1, false> {
+class base_atomic<T, int, 1, false>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -314,7 +317,7 @@
     }
 
     value_type
- load(memory_order order = memory_order_seq_cst)const volatile BOOST_NOEXCEPT
+ load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
     {
         value_type v = const_cast<const volatile storage_type &>(v_);
         platform_fence_after_load(order);
@@ -418,13 +421,14 @@
 };
 
 template<typename T>
-class base_atomic<T, int, 2, true> {
+class base_atomic<T, int, 2, true>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef int32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -436,7 +440,7 @@
     }
 
     value_type
- load(memory_order order = memory_order_seq_cst)const volatile BOOST_NOEXCEPT
+ load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
     {
         value_type v = const_cast<const volatile storage_type &>(v_);
         platform_fence_after_load(order);
@@ -540,13 +544,14 @@
 };
 
 template<typename T>
-class base_atomic<T, int, 2, false> {
+class base_atomic<T, int, 2, false>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -558,7 +563,7 @@
     }
 
     value_type
- load(memory_order order = memory_order_seq_cst)const volatile BOOST_NOEXCEPT
+ load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT
     {
         value_type v = const_cast<const volatile storage_type &>(v_);
         platform_fence_after_load(order);
@@ -662,12 +667,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 4, Sign> {
+class base_atomic<T, int, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -783,11 +789,12 @@
 /* pointer types */
 
 template<bool Sign>
-class base_atomic<void *, void *, 4, Sign> {
+class base_atomic<void *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -858,12 +865,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 4, Sign> {
+class base_atomic<T *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) : v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -955,12 +963,13 @@
 /* generic types */
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 1, Sign> {
+class base_atomic<T, void, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) : v_(0)
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
     {
         memcpy(&v_, &v, sizeof(value_type));
     }
@@ -1044,12 +1053,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 2, Sign> {
+class base_atomic<T, void, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) : v_(0)
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
     {
         memcpy(&v_, &v, sizeof(value_type));
     }
@@ -1133,12 +1143,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 4, Sign> {
+class base_atomic<T, void, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) : v_(0)
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
     {
         memcpy(&v_, &v, sizeof(value_type));
     }

Modified: trunk/boost/atomic/detail/gcc-x86.hpp
==============================================================================
--- trunk/boost/atomic/detail/gcc-x86.hpp (original)
+++ trunk/boost/atomic/detail/gcc-x86.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -151,7 +151,7 @@
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) : v_(0) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     bool
     test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
@@ -246,12 +246,13 @@
 namespace detail {
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 1, Sign> {
+class base_atomic<T, int, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -383,12 +384,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 2, Sign> {
+class base_atomic<T, int, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -520,12 +522,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, int, 4, Sign> {
+class base_atomic<T, int, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -658,12 +661,13 @@
 
 #if defined(__x86_64__)
 template<typename T, bool Sign>
-class base_atomic<T, int, 8, Sign> {
+class base_atomic<T, int, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -801,11 +805,12 @@
 #if !defined(__x86_64__)
 
 template<bool Sign>
-class base_atomic<void *, void *, 4, Sign> {
+class base_atomic<void *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -878,12 +883,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 4, Sign> {
+class base_atomic<T *, void *, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -985,11 +991,12 @@
 #else
 
 template<bool Sign>
-class base_atomic<void *, void *, 8, Sign> {
+class base_atomic<void *, void *, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef void * value_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1062,12 +1069,13 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T *, void *, 8, Sign> {
+class base_atomic<T *, void *, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T * value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1169,13 +1177,14 @@
 #endif
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 1, Sign> {
+class base_atomic<T, void, 1, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint8_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<uint8_t*>(&v))
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT :
+ v_(reinterpret_cast<storage_type const&>(v))
     {}
     base_atomic(void) {}
 
@@ -1268,13 +1277,14 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 2, Sign> {
+class base_atomic<T, void, 2, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint16_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<uint16_t*>(&v))
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT :
+ v_(reinterpret_cast<storage_type const&>(v))
     {}
     base_atomic(void) {}
 
@@ -1367,14 +1377,16 @@
 };
 
 template<typename T, bool Sign>
-class base_atomic<T, void, 4, Sign> {
+class base_atomic<T, void, 4, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint32_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT
- : v_(*reinterpret_cast<uint32_t*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
     base_atomic(void) {}
 
     void
@@ -1467,14 +1479,16 @@
 
 #if defined(__x86_64__)
 template<typename T, bool Sign>
-class base_atomic<T, void, 8, Sign> {
+class base_atomic<T, void, 8, Sign>
+{
     typedef base_atomic this_type;
     typedef T value_type;
     typedef uint64_t storage_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&tmp, &v, sizeof(value_type));
+ }
     base_atomic(void) {}
 
     void

Modified: trunk/boost/atomic/detail/generic-cas.hpp
==============================================================================
--- trunk/boost/atomic/detail/generic-cas.hpp (original)
+++ trunk/boost/atomic/detail/generic-cas.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -118,7 +118,8 @@
 
 #ifdef BOOST_ATOMIC_HAVE_CAS32
 template<typename T>
-class atomic_generic_cas32 {
+class atomic_generic_cas32
+{
 private:
     typedef atomic_generic_cas32 this_type;
 public:
@@ -168,7 +169,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 4> : public build_atomic_from_exchange<atomic_generic_cas32<T> > {
+class platform_atomic_integral<T, 4> :
+ public build_atomic_from_exchange<atomic_generic_cas32<T> >
+{
 public:
     typedef build_atomic_from_exchange<atomic_generic_cas32<T> > super;
     explicit platform_atomic_integral(T v) : super(v) {}
@@ -176,7 +179,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 1>: public build_atomic_from_larger_type<atomic_generic_cas32<int32_t>, T> {
+class platform_atomic_integral<T, 1> :
+ public build_atomic_from_larger_type<atomic_generic_cas32<int32_t>, T>
+{
 public:
     typedef build_atomic_from_larger_type<atomic_generic_cas32<int32_t>, T> super;
 
@@ -185,7 +190,9 @@
 };
 
 template<typename T>
-class platform_atomic_integral<T, 2>: public build_atomic_from_larger_type<atomic_generic_cas32<int32_t>, T> {
+class platform_atomic_integral<T, 2> :
+ public build_atomic_from_larger_type<atomic_generic_cas32<int32_t>, T>
+{
 public:
     typedef build_atomic_from_larger_type<atomic_generic_cas32<int32_t>, T> super;
 

Modified: trunk/boost/atomic/detail/interlocked.hpp
==============================================================================
--- trunk/boost/atomic/detail/interlocked.hpp (original)
+++ trunk/boost/atomic/detail/interlocked.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -2,7 +2,7 @@
 #define BOOST_ATOMIC_DETAIL_INTERLOCKED_HPP
 
 // Copyright (c) 2009 Helge Bahmann
-// Copyright (c) 2012 Andrey Semashev
+// Copyright (c) 2012, 2013 Andrey Semashev
 //
 // Distributed under the Boost Software License, Version 1.0.
 // See accompanying file LICENSE_1_0.txt or copy at
@@ -14,7 +14,7 @@
 #pragma once
 #endif
 
-#if defined(_WIN32_WCE)
+#if defined(_WIN32_WCE) || (defined(_MSC_VER) && _MSC_VER < 1400)
 
 #include <boost/detail/interlocked.hpp>
 
@@ -25,30 +25,24 @@
 #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) BOOST_INTERLOCKED_EXCHANGE_POINTER(dest, newval)
 #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset))
 
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && _MSC_VER >= 1400
 
 #include <intrin.h>
 
 #pragma intrinsic(_InterlockedCompareExchange)
 #pragma intrinsic(_InterlockedExchangeAdd)
 #pragma intrinsic(_InterlockedExchange)
-
-#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))
-#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend))
-#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval))
-
-#if _MSC_VER >= 1400
-
 #pragma intrinsic(_InterlockedAnd)
 #pragma intrinsic(_InterlockedOr)
 #pragma intrinsic(_InterlockedXor)
 
+#define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE(dest, exchange, compare) _InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare))
+#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD(dest, addend) _InterlockedExchangeAdd((long*)(dest), (long)(addend))
+#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE(dest, newval) _InterlockedExchange((long*)(dest), (long)(newval))
 #define BOOST_ATOMIC_INTERLOCKED_AND(dest, arg) _InterlockedAnd((long*)(dest), (long)(arg))
 #define BOOST_ATOMIC_INTERLOCKED_OR(dest, arg) _InterlockedOr((long*)(dest), (long)(arg))
 #define BOOST_ATOMIC_INTERLOCKED_XOR(dest, arg) _InterlockedXor((long*)(dest), (long)(arg))
 
-#endif // _MSC_VER >= 1400
-
 #if _MSC_VER >= 1600
 
 // MSVC 2010 and later provide intrinsics for 8 and 16 bit integers.
@@ -108,15 +102,15 @@
 #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) _InterlockedExchangePointer((void**)(dest), (void*)(newval))
 #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64((long*)(dest), byte_offset))
 
-#else // defined(_M_AMD64)
+#else // defined(_M_AMD64) || defined(_M_IA64)
 
 #define BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest, exchange, compare) ((void*)_InterlockedCompareExchange((long*)(dest), (long)(exchange), (long)(compare)))
 #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_POINTER(dest, newval) ((void*)_InterlockedExchange((long*)(dest), (long)(newval)))
 #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset))
 
-#endif // defined(_M_AMD64)
+#endif // defined(_M_AMD64) || defined(_M_IA64)
 
-#else // defined(_MSC_VER)
+#else // defined(_MSC_VER) && _MSC_VER >= 1400
 
 #if defined(BOOST_USE_WINDOWS_H)
 

Modified: trunk/boost/atomic/detail/linux-arm.hpp
==============================================================================
--- trunk/boost/atomic/detail/linux-arm.hpp (original)
+++ trunk/boost/atomic/detail/linux-arm.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -133,13 +133,14 @@
     __asm__ __volatile__ ("" ::: "memory");
 }
 
-class atomic_flag {
+class atomic_flag
+{
 private:
     atomic_flag(const atomic_flag &) /* = delete */ ;
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) BOOST_NOEXCEPT: v_(false) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     void
     clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT

Modified: trunk/boost/atomic/detail/windows.hpp
==============================================================================
--- trunk/boost/atomic/detail/windows.hpp (original)
+++ trunk/boost/atomic/detail/windows.hpp 2013-02-23 09:21:19 EST (Sat, 23 Feb 2013)
@@ -3,7 +3,7 @@
 
 // Copyright (c) 2009 Helge Bahmann
 // Copyright (c) 2012 Andrey Semashev
-// Copyright (c) 2013 Tim Blechmann
+// Copyright (c) 2013 Tim Blechmann, Andrey Semashev
 //
 // Distributed under the Boost Software License, Version 1.0.
 // See accompanying file LICENSE_1_0.txt or copy at
@@ -25,10 +25,6 @@
 #pragma warning(disable: 4100)
 #endif
 
-namespace boost {
-namespace atomics {
-namespace detail {
-
 #if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86))
 extern "C" void _mm_pause(void);
 #pragma intrinsic(_mm_pause)
@@ -43,6 +39,23 @@
 #pragma intrinsic(_mm_mfence)
 #endif
 
+// Define compiler barriers
+#if defined(__INTEL_COMPILER)
+#define BOOST_ATOMIC_COMPILER_BARRIER __memory_barrier();
+#elif defined(_MSC_VER) && _MSC_VER >= 1310 && !defined(_WIN32_WCE)
+extern "C" void _ReadWriteBarrier(void);
+#pragma intrinsic(_ReadWriteBarrier)
+#define BOOST_ATOMIC_COMPILER_BARRIER() _ReadWriteBarrier()
+#endif
+
+#ifndef BOOST_ATOMIC_COMPILER_BARRIER
+#define BOOST_ATOMIC_COMPILER_BARRIER()
+#endif
+
+namespace boost {
+namespace atomics {
+namespace detail {
+
 BOOST_FORCEINLINE void hardware_full_fence(void)
 {
 #if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2))
@@ -58,41 +71,41 @@
 #if defined(_MSC_VER) && _MSC_VER >= 1310 && !defined(_WIN32_WCE)
 extern "C" void _ReadWriteBarrier();
 #pragma intrinsic(_ReadWriteBarrier)
-#define BOOST_ATOMIC_READ_WRITE_BARRIER() _ReadWriteBarrier()
+#define BOOST_ATOMIC_COMPILER_BARRIER() _ReadWriteBarrier()
 #endif
 
-#ifndef BOOST_ATOMIC_READ_WRITE_BARRIER
-#define BOOST_ATOMIC_READ_WRITE_BARRIER()
+#ifndef BOOST_ATOMIC_COMPILER_BARRIER
+#define BOOST_ATOMIC_COMPILER_BARRIER()
 #endif
 
 BOOST_FORCEINLINE void
 platform_fence_before(memory_order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
 }
 
 BOOST_FORCEINLINE void
 platform_fence_after(memory_order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
 }
 
 BOOST_FORCEINLINE void
 platform_fence_before_store(memory_order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
 }
 
 BOOST_FORCEINLINE void
 platform_fence_after_store(memory_order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
 }
 
 BOOST_FORCEINLINE void
 platform_fence_after_load(memory_order order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
 
     // On x86 and x86_64 there is no need for a hardware barrier,
     // even if seq_cst memory order is requested, because all
@@ -113,7 +126,7 @@
 BOOST_FORCEINLINE void
 atomic_thread_fence(memory_order order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
     if (order == memory_order_seq_cst)
         atomics::detail::hardware_full_fence();
 }
@@ -122,10 +135,10 @@
 BOOST_FORCEINLINE void
 atomic_signal_fence(memory_order)
 {
- BOOST_ATOMIC_READ_WRITE_BARRIER();
+ BOOST_ATOMIC_COMPILER_BARRIER();
 }
 
-#undef BOOST_ATOMIC_READ_WRITE_BARRIER
+#undef BOOST_ATOMIC_COMPILER_BARRIER
 
 class atomic_flag
 {
@@ -134,7 +147,7 @@
     atomic_flag & operator=(const atomic_flag &) /* = delete */ ;
     uint32_t v_;
 public:
- atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
+ BOOST_CONSTEXPR atomic_flag(void) BOOST_NOEXCEPT : v_(0) {}
 
     bool
     test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
@@ -196,7 +209,7 @@
 #endif
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
     base_atomic(void) {}
 
     void
@@ -382,7 +395,7 @@
 #endif
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
     base_atomic(void) {}
 
     void
@@ -560,7 +573,7 @@
     typedef value_type storage_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
     base_atomic(void) {}
 
     void
@@ -713,7 +726,7 @@
     typedef value_type storage_type;
     typedef T difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
     base_atomic(void) {}
 
     void
@@ -867,7 +880,7 @@
     typedef base_atomic this_type;
     typedef void* value_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
     base_atomic(void) {}
 
     void
@@ -939,7 +952,7 @@
     typedef T* value_type;
     typedef ptrdiff_t difference_type;
 public:
- BOOST_CONSTEXPR base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
+ BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT: v_(v) {}
     base_atomic(void) {}
 
     void
@@ -1040,9 +1053,16 @@
     typedef uint32_t storage_type;
 #endif
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE8
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(reinterpret_cast< storage_type const& >(v))
+ {
+ }
+#else
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+#endif
     base_atomic(void) {}
 
     void
@@ -1144,9 +1164,16 @@
     typedef uint32_t storage_type;
 #endif
 public:
- BOOST_CONSTEXPR base_atomic(value_type const& v) BOOST_NOEXCEPT:
- v_(*reinterpret_cast<storage_type*>(&v))
- {}
+#ifdef BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE16
+ BOOST_CONSTEXPR explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(reinterpret_cast< storage_type const& >(v))
+ {
+ }
+#else
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ {
+ memcpy(&v_, &v, sizeof(value_type));
+ }
+#endif
 
     base_atomic(void) {}
 


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