Skip to content

Commit 1f5a559

Browse files
committed
GraphBLAS: Avoid warning from Clang 17.
Clang 17 emits more warnings (or errors) when it comes to incompatible pointer types. `_InterlockedCompareExchange` is declared with `long volatile *` as the type of its first input argument See: https://learn.microsoft.com/en-us/cpp/intrinsics/interlockedcompareexchange-intrinsic-functions?view=msvc-170 `int32_t` is `int` on Windows. While `long` and `int` have the same size on Windows (LLP64 data model), they are technically distinct types. Avoid the compiler warning by casting to the pointer type expected by that function.
1 parent a0926d6 commit 1f5a559

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

GraphBLAS/Source/omp/include/GB_atomics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@
410410
#define GB_ATOMIC_COMPARE_EXCHANGE_32(target, expected, desired) \
411411
( \
412412
GB_PUN (int32_t, expected) == \
413-
_InterlockedCompareExchange ((int32_t volatile *) (target), \
413+
_InterlockedCompareExchange ((long volatile *) (target), \
414414
GB_PUN (int32_t, desired), GB_PUN (int32_t, expected)) \
415415
)
416416

0 commit comments

Comments
 (0)