在 2018/9/9 4:24, Martin Storsjö 写道:
> This fixes building for armv7 with -fms-extensions enabled.
> 
> Signed-off-by: Martin Storsjö <mar...@martin.st>
> ---
> The last ifdef/pragma looks misplaced, but it's just how git chooses
> the make the diff.
> ---
>   mingw-w64-headers/include/winbase.h | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
> 

This looks good to me, too.

> diff --git a/mingw-w64-headers/include/winbase.h 
> b/mingw-w64-headers/include/winbase.h
> index b2d4769..2b47378 100644
> --- a/mingw-w64-headers/include/winbase.h
> +++ b/mingw-w64-headers/include/winbase.h
> @@ -969,6 +969,15 @@ extern "C" {
>     LONG64 InterlockedCompareExchange64 (LONG64 volatile *Destination, LONG64 
> ExChange, LONG64 Comperand);
>   #else
>   #if !defined (__WIDL__) && defined (__MINGW_INTRIN_INLINE)
> +
> +/* Clang has support for some MSVC builtins if building with -fms-extensions,
> + * GCC doesn't. */
> +#pragma push_macro("__has_builtin")
> +#ifndef __has_builtin
> +  #define __has_builtin(x) 0
> +#endif
> +
> +#if !__has_builtin(_InterlockedAnd64)
>     FORCEINLINE LONGLONG InterlockedAnd64 (LONGLONG volatile *Destination, 
> LONGLONG Value) {
>       LONGLONG Old;
>   
> @@ -977,7 +986,9 @@ extern "C" {
>       } while (InterlockedCompareExchange64 (Destination, Old &Value, Old) != 
> Old);
>       return Old;
>     }
> +#endif
>   
> +#if !__has_builtin(_InterlockedOr64)
>     FORCEINLINE LONGLONG InterlockedOr64 (LONGLONG volatile *Destination, 
> LONGLONG Value) {
>       LONGLONG Old;
>   
> @@ -986,7 +997,9 @@ extern "C" {
>       } while (InterlockedCompareExchange64 (Destination, Old | Value, Old) 
> != Old);
>       return Old;
>     }
> +#endif
>   
> +#if !__has_builtin(_InterlockedXor64)
>     FORCEINLINE LONGLONG InterlockedXor64 (LONGLONG volatile *Destination, 
> LONGLONG Value) {
>       LONGLONG Old;
>   
> @@ -995,7 +1008,9 @@ extern "C" {
>       } while (InterlockedCompareExchange64 (Destination, Old ^ Value, Old) 
> != Old);
>       return Old;
>     }
> +#endif
>   
> +#if !__has_builtin(_InterlockedIncrement64)
>     FORCEINLINE LONGLONG InterlockedIncrement64 (LONGLONG volatile *Addend) {
>       LONGLONG Old;
>   
> @@ -1004,7 +1019,9 @@ extern "C" {
>       } while (InterlockedCompareExchange64 (Addend, Old + 1, Old) != Old);
>       return Old + 1;
>     }
> +#endif
>   
> +#if !__has_builtin(_InterlockedDecrement64)
>     FORCEINLINE LONGLONG InterlockedDecrement64 (LONGLONG volatile *Addend) {
>       LONGLONG Old;
>   
> @@ -1013,7 +1030,9 @@ extern "C" {
>       } while (InterlockedCompareExchange64 (Addend, Old - 1, Old) != Old);
>       return Old - 1;
>     }
> +#endif
>   
> +#if !__has_builtin(_InterlockedExchange64)
>     FORCEINLINE LONGLONG InterlockedExchange64 (LONGLONG volatile *Target, 
> LONGLONG Value) {
>       LONGLONG Old;
>   
> @@ -1022,7 +1041,9 @@ extern "C" {
>       } while (InterlockedCompareExchange64 (Target, Value, Old) != Old);
>       return Old;
>     }
> +#endif
>   
> +#if !__has_builtin(_InterlockedExchangeAdd64)
>     FORCEINLINE LONGLONG InterlockedExchangeAdd64 (LONGLONG volatile *Addend, 
> LONGLONG Value) {
>       LONGLONG Old;
>   
> @@ -1033,6 +1054,10 @@ extern "C" {
>     }
>   #endif
>   
> +#pragma pop_macro("__has_builtin")
> +
> +#endif
> +
>   #ifdef __cplusplus
>     FORCEINLINE PVOID __cdecl __InlineInterlockedCompareExchangePointer 
> (PVOID volatile *Destination, PVOID ExChange, PVOID Comperand) {
>       return ((PVOID) (LONG_PTR)InterlockedCompareExchange ((LONG volatile 
> *)Destination,(LONG) (LONG_PTR)ExChange,(LONG) (LONG_PTR)Comperand));
> 


-- 
Best regards,
LH_Mouse

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to