From ca937496146d3f194566068101797abd1b686677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 18 Oct 2015 12:51:13 +0200 Subject: [PATCH 1/2] Support MSVC-7.1/ intrin.h available >= MSVC-8.0 -> MSVC 7.1 has no intrin.h and needs to use "#pragma intrinsic". -> intrin.h available since Visual 2005 --- include/boost/smart_ptr/detail/sp_interlocked.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/boost/smart_ptr/detail/sp_interlocked.hpp b/include/boost/smart_ptr/detail/sp_interlocked.hpp index 814b0c2..6e3b45e 100644 --- a/include/boost/smart_ptr/detail/sp_interlocked.hpp +++ b/include/boost/smart_ptr/detail/sp_interlocked.hpp @@ -22,7 +22,7 @@ // BOOST_SP_HAS_INTRIN_H // VC9 has intrin.h, but it collides with -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1400 # define BOOST_SP_HAS_INTRIN_H @@ -111,6 +111,17 @@ extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); +# if defined( BOOST_MSVC ) && BOOST_MSVC == 1310 +//From MSDN, Visual Studio .NET 2003 spedific: To declare one of the interlocked functions +//for use as an intrinsic, the function must be declared with the leading underscore and +//the new function must appear in a #pragma intrinsic statement. +# pragma intrinsic( _InterlockedIncrement ) +# pragma intrinsic( _InterlockedDecrement ) +# pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) +# endif + #endif # define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement From 3f17244225a9426cf399de13c65f5135472b72c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 18 Oct 2015 19:44:17 +0200 Subject: [PATCH 2/2] Removed the intrin.h-related part Removed the commented part as the comment clearly says that VC9 has problems when intrin.h is included. --- include/boost/smart_ptr/detail/sp_interlocked.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/smart_ptr/detail/sp_interlocked.hpp b/include/boost/smart_ptr/detail/sp_interlocked.hpp index 6e3b45e..79cae14 100644 --- a/include/boost/smart_ptr/detail/sp_interlocked.hpp +++ b/include/boost/smart_ptr/detail/sp_interlocked.hpp @@ -22,7 +22,7 @@ // BOOST_SP_HAS_INTRIN_H // VC9 has intrin.h, but it collides with -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1400 +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 # define BOOST_SP_HAS_INTRIN_H