bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simple-atomic: Fix a clang warning on native Windows


From: Bruno Haible
Subject: simple-atomic: Fix a clang warning on native Windows
Date: Tue, 27 Aug 2024 23:01:48 +0200

clang on native Windows produces a warning:

gllib\simple-atomic.c(59,10): warning: incompatible pointer to integer 
conversion returning 'void *' from a function with result type 'uintptr_t' (aka 
'unsigned long long') [-Wint-conversion]

This patch purports to fix it.


2024-08-27  Bruno Haible  <bruno@clisp.org>

        simple-atomic: Fix a clang warning on native Windows.
        * lib/simple-atomic.c (atomic_compare_and_swap_ptr): Add a cast.

diff --git a/lib/simple-atomic.c b/lib/simple-atomic.c
index 656b4bdc19..5319825d32 100644
--- a/lib/simple-atomic.c
+++ b/lib/simple-atomic.c
@@ -56,7 +56,8 @@ atomic_compare_and_swap_ptr (uintptr_t volatile *vp,
 {
   /* InterlockedCompareExchangePointer
      
<https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedcompareexchangepointer>
  */
-  return InterlockedCompareExchangePointer ((void * volatile *) vp,
+  return (uintptr_t)
+         InterlockedCompareExchangePointer ((void * volatile *) vp,
                                             (void *) newval, (void *) cmp);
 }
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]