include: _InterlockedExchangePointer and _InterlockedCompareExchangePointer are intrinsics in x86 msvc.
I fixed this issue in ad05f33d67, but a40973f20 regressed this again. I was carrying a patch for quite a while, feeling dejavu.
The msvc ver of 1900 is taken from Boost's interlocked.hpp, which matches MSVC 2015 (toolset version v140). Boost has a comment that claims that in msvc 2012 those functions were defined in intrin.h, but those defines are broken with Microsoft's winnt.h.
From: Stefan Dösinger stefan@codeweavers.com
I fixed this issue in ad05f33d67, but a40973f20 regressed this again. I was carrying a patch for quite a while, feeling dejavu.
The msvc ver of 1900 is taken from Boost's interlocked.hpp, which matches MSVC 2015 (toolset version v140). Boost has a comment that claims that in msvc 2012 those functions were defined in intrin.h, but those defines are broken with Microsoft's winnt.h. --- include/winnt.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/winnt.h b/include/winnt.h index e15ac364ef2..3c26e6e8520 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6595,10 +6595,15 @@ static FORCEINLINE __int64 InterlockedAnd64( __int64 volatile *dest, __int64 val return prev; }
+#if _MSC_VER >= 1900 +#pragma intrinsic(_InterlockedCompareExchangePointer) +void *_InterlockedCompareExchangePointer(void *volatile *, void *, void *); +#else static FORCEINLINE void * WINAPI InterlockedCompareExchangePointer( void *volatile *dest, void *xchg, void *compare ) { return (void *)_InterlockedCompareExchange( (long volatile*)dest, (long)xchg, (long)compare ); } +#endif
static FORCEINLINE __int64 InterlockedExchangeAdd64( __int64 volatile *dest, __int64 val ) { @@ -6607,10 +6612,15 @@ static FORCEINLINE __int64 InterlockedExchangeAdd64( __int64 volatile *dest, __i return prev; }
+#if _MSC_VER > 1900 +#pragma intrinsic(_InterlockedExchangePointer) +void *_InterlockedExchangePointer(void *volatile *, void *); +#else static FORCEINLINE void * WINAPI InterlockedExchangePointer( void *volatile *dest, void *val ) { return (void *)_InterlockedExchange( (long volatile*)dest, (long)val ); } +#endif
static FORCEINLINE __int64 InterlockedIncrement64( __int64 volatile *dest ) {
The msvc ver of 1900 is taken from Boost's interlocked.hpp, which matches MSVC 2015 (toolset version v140). Boost has a comment that claims that in msvc 2012 those functions were defined in intrin.h, but those defines are broken with Microsoft's winnt.h.
I don't think we need version checks for such old versions, especially if we haven't tested them.