Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85865 - trunk/boost/detail
From: andrey.semashev_at_[hidden]
Date: 2013-09-24 08:49:46


Author: andysem
Date: 2013-09-24 08:49:46 EDT (Tue, 24 Sep 2013)
New Revision: 85865
URL: http://svn.boost.org/trac/boost/changeset/85865

Log:
Fixed compilation problems with MinGW-w64.

Text files modified:
   trunk/boost/detail/interlocked.hpp | 26 +++++++++++++++++++++-----
   1 files changed, 21 insertions(+), 5 deletions(-)

Modified: trunk/boost/detail/interlocked.hpp
==============================================================================
--- trunk/boost/detail/interlocked.hpp Tue Sep 24 02:41:24 2013 (r85864)
+++ trunk/boost/detail/interlocked.hpp 2013-09-24 08:49:46 EDT (Tue, 24 Sep 2013) (r85865)
@@ -125,14 +125,30 @@
 # define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
 # define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
 
+// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets.
+#elif defined(__MINGW64_VERSION_MAJOR)
+
+// MinGW-w64 provides intrin.h for both 32 and 64-bit targets.
+#include <intrin.h>
+
+# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
+# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
+# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+# if defined(__x86_64__) || defined(__x86_64)
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
+# else
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
+ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
+ ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
+# endif
+
 #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
 
-#if defined(__MINGW64__)
-#define BOOST_INTERLOCKED_IMPORT
-#else
 #define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
-#endif
-
 
 namespace boost
 {


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