Skip to content

Commit

Permalink
GraphBLAS: Avoid warning from Clang 17.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mmuetzel committed Jun 7, 2024
1 parent a0926d6 commit 1f5a559
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion GraphBLAS/Source/omp/include/GB_atomics.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
#define GB_ATOMIC_COMPARE_EXCHANGE_32(target, expected, desired) \
( \
GB_PUN (int32_t, expected) == \
_InterlockedCompareExchange ((int32_t volatile *) (target), \
_InterlockedCompareExchange ((long volatile *) (target), \
GB_PUN (int32_t, desired), GB_PUN (int32_t, expected)) \
)

Expand Down

0 comments on commit 1f5a559

Please sign in to comment.