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.
-- v2: include: x86 msvc has _InterlockedExchangePointer and _InterlockedCompareExchangePointer
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.
According to boost they are available since MSVC 2015. I don't have old versions of msvc hanging around, and we don't put much value in keeping old versions working, so just use them unconditionally. --- include/winnt.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/include/winnt.h b/include/winnt.h index e15ac364ef2..15c254fbcff 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6541,8 +6541,10 @@ typedef enum _FIRMWARE_TYPE #pragma intrinsic(_InterlockedAnd) #pragma intrinsic(_InterlockedCompareExchange) #pragma intrinsic(_InterlockedCompareExchange64) +#pragma intrinsic(_InterlockedCompareExchangePointer) #pragma intrinsic(_InterlockedExchange) #pragma intrinsic(_InterlockedExchangeAdd) +#pragma intrinsic(_InterlockedExchangePointer) #pragma intrinsic(_InterlockedIncrement) #pragma intrinsic(_InterlockedIncrement16) #pragma intrinsic(_InterlockedDecrement) @@ -6556,10 +6558,12 @@ BOOLEAN _BitScanReverse(unsigned long*,unsigned long); long _InterlockedAnd(long volatile *,long); long _InterlockedCompareExchange(long volatile*,long,long); long long _InterlockedCompareExchange64(long long volatile*,long long,long long); +void * _InterlockedCompareExchangePointer(void *volatile*,void*,void*); long _InterlockedDecrement(long volatile*); short _InterlockedDecrement16(short volatile*); long _InterlockedExchange(long volatile*,long); long _InterlockedExchangeAdd(long volatile*,long); +void * _InterlockedExchangePointer(void *volatile*,void*); long _InterlockedIncrement(long volatile*); short _InterlockedIncrement16(short volatile*); long _InterlockedOr(long volatile *,long); @@ -6569,19 +6573,15 @@ DECLSPEC_NORETURN void __fastfail(unsigned int); #ifndef __i386__
#pragma intrinsic(_InterlockedAnd64) -#pragma intrinsic(_InterlockedCompareExchangePointer) #pragma intrinsic(_InterlockedDecrement64) #pragma intrinsic(_InterlockedExchangeAdd64) -#pragma intrinsic(_InterlockedExchangePointer) #pragma intrinsic(_InterlockedIncrement64) #pragma intrinsic(_InterlockedOr64) #pragma intrinsic(_InterlockedXor64)
__int64 _InterlockedAnd64(__int64 volatile *, __int64); -void * _InterlockedCompareExchangePointer(void *volatile*,void*,void*); __int64 _InterlockedDecrement64(__int64 volatile *); __int64 _InterlockedExchangeAdd64(__int64 volatile *, __int64); -void * _InterlockedExchangePointer(void *volatile*,void*); __int64 _InterlockedIncrement64(__int64 volatile *); __int64 _InterlockedOr64(__int64 volatile *, __int64); __int64 _InterlockedXor64(__int64 volatile *, __int64); @@ -6595,11 +6595,6 @@ static FORCEINLINE __int64 InterlockedAnd64( __int64 volatile *dest, __int64 val return prev; }
-static FORCEINLINE void * WINAPI InterlockedCompareExchangePointer( void *volatile *dest, void *xchg, void *compare ) -{ - return (void *)_InterlockedCompareExchange( (long volatile*)dest, (long)xchg, (long)compare ); -} - static FORCEINLINE __int64 InterlockedExchangeAdd64( __int64 volatile *dest, __int64 val ) { __int64 prev; @@ -6607,11 +6602,6 @@ static FORCEINLINE __int64 InterlockedExchangeAdd64( __int64 volatile *dest, __i return prev; }
-static FORCEINLINE void * WINAPI InterlockedExchangePointer( void *volatile *dest, void *val ) -{ - return (void *)_InterlockedExchange( (long volatile*)dest, (long)val ); -} - static FORCEINLINE __int64 InterlockedIncrement64( __int64 volatile *dest ) { return InterlockedExchangeAdd64( dest, 1 ) + 1;