Skip to content

Commit 0267128

Browse files
segevfinerpitrou
authored andcommitted
bpo-9566 & bpo-30747: Silence warnings from pyatomic.h macros (#3140)
* bpo-9566: Silence warnings from pyatomic.h macros Apparently MSVC is too stupid to understand that the alternate branch is not taken and emits a warning for it. Warnings added in #2383 * bpo-9566: A better fix for the pyatomic.h warning * bpo-9566: Remove a slash
1 parent 1d1d3e9 commit 0267128

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Include/pyatomic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,14 @@ inline int _Py_atomic_load_32bit(volatile int* value, int order) {
352352

353353
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
354354
if (sizeof(*ATOMIC_VAL._value) == 8) { \
355-
_Py_atomic_store_64bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } else { \
356-
_Py_atomic_store_32bit(ATOMIC_VAL._value, NEW_VAL, ORDER) }
355+
_Py_atomic_store_64bit((volatile long long*)ATOMIC_VAL._value, NEW_VAL, ORDER) } else { \
356+
_Py_atomic_store_32bit((volatile long*)ATOMIC_VAL._value, NEW_VAL, ORDER) }
357357

358358
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
359359
( \
360360
sizeof(*(ATOMIC_VAL._value)) == 8 ? \
361-
_Py_atomic_load_64bit(ATOMIC_VAL._value, ORDER) : \
362-
_Py_atomic_load_32bit(ATOMIC_VAL._value, ORDER) \
361+
_Py_atomic_load_64bit((volatile long long*)ATOMIC_VAL._value, ORDER) : \
362+
_Py_atomic_load_32bit((volatile long*)ATOMIC_VAL._value, ORDER) \
363363
)
364364
#elif defined(_M_ARM) || defined(_M_ARM64)
365365
typedef enum _Py_memory_order {

0 commit comments

Comments
 (0)