Skip to content

Commit a1479b9

Browse files
committed
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 python#2383
1 parent 4d38517 commit a1479b9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎Include/pyatomic.h‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,21 @@ inline int _Py_atomic_load_32bit(volatile int* value, int order) {
351351
}
352352

353353
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
354+
__pragma(warning(push)) \
355+
__pragma(warning(disable: 4133)) \
354356
if (sizeof(*ATOMIC_VAL._value) == 8) { \
355357
_Py_atomic_store_64bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } else { \
356-
_Py_atomic_store_32bit(ATOMIC_VAL._value, NEW_VAL, ORDER) }
358+
_Py_atomic_store_32bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } \
359+
__pragma(warning(pop))
357360

358361
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
359362
( \
363+
__pragma(warning(push)) \
364+
__pragma(warning(disable: 4133)) \
360365
sizeof(*(ATOMIC_VAL._value)) == 8 ? \
361366
_Py_atomic_load_64bit(ATOMIC_VAL._value, ORDER) : \
362367
_Py_atomic_load_32bit(ATOMIC_VAL._value, ORDER) \
368+
__pragma(warning(pop)) \
363369
)
364370
#elif defined(_M_ARM) || defined(_M_ARM64)
365371
typedef enum _Py_memory_order {

0 commit comments

Comments
 (0)