diff mbox series

[FFmpeg-devel,v2] atomics: Fix the win32 atomic_exchange function

Message ID 20210403215343.2127885-1-martin@martin.st
State Accepted
Commit b1b7cc698bed7338ff692cd65fe304941eaf6bce
Headers show
Series [FFmpeg-devel,v2] atomics: Fix the win32 atomic_exchange function
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Martin Storsjö April 3, 2021, 9:53 p.m. UTC
This fixes building with MSVC after
a2a38b160620d91bc3f895dadc4501c589998b9c.

Remove the stray semicolon, and add casts for the input argument
(which is an intptr_t*) to the right type (void *volatile *).
---
Changed to use PVOID.
---
 compat/atomics/win32/stdatomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer April 3, 2021, 9:59 p.m. UTC | #1
On 4/3/2021 6:53 PM, Martin Storsjö wrote:
> This fixes building with MSVC after
> a2a38b160620d91bc3f895dadc4501c589998b9c.
> 
> Remove the stray semicolon, and add casts for the input argument
> (which is an intptr_t*) to the right type (void *volatile *).
> ---
> Changed to use PVOID.
> ---
>   compat/atomics/win32/stdatomic.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/compat/atomics/win32/stdatomic.h b/compat/atomics/win32/stdatomic.h
> index bb8e6e7e15..28a627bfd3 100644
> --- a/compat/atomics/win32/stdatomic.h
> +++ b/compat/atomics/win32/stdatomic.h
> @@ -96,7 +96,7 @@ do {                                    \
>       atomic_load(object)
>   
>   #define atomic_exchange(object, desired) \
> -    InterlockedExchangePointer(object, desired);
> +    InterlockedExchangePointer((PVOID volatile *)object, (PVOID)desired)
>   
>   #define atomic_exchange_explicit(object, desired, order) \
>       atomic_exchange(object, desired)

Should be ok. Thanks.
diff mbox series

Patch

diff --git a/compat/atomics/win32/stdatomic.h b/compat/atomics/win32/stdatomic.h
index bb8e6e7e15..28a627bfd3 100644
--- a/compat/atomics/win32/stdatomic.h
+++ b/compat/atomics/win32/stdatomic.h
@@ -96,7 +96,7 @@  do {                                    \
     atomic_load(object)
 
 #define atomic_exchange(object, desired) \
-    InterlockedExchangePointer(object, desired);
+    InterlockedExchangePointer((PVOID volatile *)object, (PVOID)desired)
 
 #define atomic_exchange_explicit(object, desired, order) \
     atomic_exchange(object, desired)