Update to support builtins where -fms-extensions is both enabled or disabled
diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h index 9645e24..6100290 100644 --- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h +++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -80,6 +80,11 @@ #define __FLAGCLOBBER2 #endif +/* Clang has support for MSVC builtins, GCC doesn't */ +#ifndef __has_builtin + #define __has_builtin(x) 0 +#endif + /* This macro is used by __stosb, __stosw, __stosd, __stosq */ /* Parameters: (FunctionName, DataType, Operator) @@ -1015,7 +1020,7 @@ #if __INTRINSIC_PROLOG(_InterlockedExchangeAdd) __LONG32 _InterlockedExchangeAdd(__LONG32 volatile *Addend, __LONG32 Value); -#ifndef __clang__ +#if !__has_builtin(_InterlockedExchangeAdd) __INTRINSICS_USEINLINE __LONG32 _InterlockedExchangeAdd(__LONG32 volatile *Addend, __LONG32 Value) { return __sync_fetch_and_add(Addend, Value); @@ -1026,7 +1031,7 @@ #if __INTRINSIC_PROLOG(_InterlockedCompareExchange) __LONG32 _InterlockedCompareExchange(__LONG32 volatile *Destination, __LONG32 ExChange, __LONG32 Comperand); -#ifndef __clang__ +#if !__has_builtin(_InterlockedCompareExchange) __INTRINSICS_USEINLINE __LONG32 _InterlockedCompareExchange(__LONG32 volatile *Destination, __LONG32 ExChange, __LONG32 Comperand) { return __sync_val_compare_and_swap(Destination, Comperand, ExChange); @@ -1037,7 +1042,7 @@ #if __INTRINSIC_PROLOG(_InterlockedIncrement) __LONG32 _InterlockedIncrement(__LONG32 volatile *Addend); -#ifndef __clang__ +#if !__has_builtin(_InterlockedIncrement) __INTRINSICS_USEINLINE __LONG32 _InterlockedIncrement(__LONG32 volatile *Addend) { return __sync_add_and_fetch(Addend, 1); @@ -1048,7 +1053,7 @@ #if __INTRINSIC_PROLOG(_InterlockedDecrement) __LONG32 _InterlockedDecrement(__LONG32 volatile *Addend); -#ifndef __clang__ +#if !__has_builtin(_InterlockedDecrement) __INTRINSICS_USEINLINE __LONG32 _InterlockedDecrement(__LONG32 volatile *Addend) { return __sync_sub_and_fetch(Addend, 1); @@ -1077,7 +1082,7 @@ #if __INTRINSIC_PROLOG(_InterlockedExchange) __LONG32 _InterlockedExchange(__LONG32 volatile *Target, __LONG32 Value); -#ifndef __clang__ +#if !__has_builtin(_InterlockedExchange) __INTRINSICS_USEINLINE __LONG32 _InterlockedExchange(__LONG32 volatile *Target, __LONG32 Value) { return __sync_lock_test_and_set(Target, Value); @@ -1097,7 +1102,7 @@ #if __INTRINSIC_PROLOG(_InterlockedCompareExchangePointer) void *_InterlockedCompareExchangePointer(void * volatile *Destination, void *ExChange, void *Comperand); -#ifndef __clang__ +#if !__has_builtin(_InterlockedCompareExchangePointer) __INTRINSICS_USEINLINE void *_InterlockedCompareExchangePointer(void *volatile *Destination, void *ExChange, void *Comperand) { return __sync_val_compare_and_swap(Destination, Comperand, ExChange); @@ -1108,7 +1113,7 @@ #if __INTRINSIC_PROLOG(_InterlockedExchangePointer) void *_InterlockedExchangePointer(void *volatile *Target,void *Value); -#ifndef __clang__ +#if !__has_builtin(_InterlockedExchangePointer) __INTRINSICS_USEINLINE void *_InterlockedExchangePointer(void *volatile *Target,void *Value) { return __sync_lock_test_and_set(Target, Value);