]> granicus.if.org Git - python/commitdiff
bpo-9566 & bpo-30747: Silence warnings from pyatomic.h macros (#3140)
authorSegev Finer <segev208@gmail.com>
Sun, 20 Aug 2017 22:45:46 +0000 (01:45 +0300)
committerAntoine Pitrou <pitrou@free.fr>
Sun, 20 Aug 2017 22:45:46 +0000 (00:45 +0200)
* 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 https://github.com/python/cpython/pull/2383

* bpo-9566: A better fix for the pyatomic.h warning

* bpo-9566: Remove a slash

Include/pyatomic.h

index 832d951f843264488442713061033a1be3d36cb8..4cbc529c0d1e8fe85f7558d0bdaf72e1ee48e3ca 100644 (file)
@@ -352,14 +352,14 @@ inline int _Py_atomic_load_32bit(volatile int* value, int order) {
 
 #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
   if (sizeof(*ATOMIC_VAL._value) == 8) { \
-    _Py_atomic_store_64bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } else { \
-    _Py_atomic_store_32bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } 
+    _Py_atomic_store_64bit((volatile long long*)ATOMIC_VAL._value, NEW_VAL, ORDER) } else { \
+    _Py_atomic_store_32bit((volatile long*)ATOMIC_VAL._value, NEW_VAL, ORDER) }
 
 #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
   ( \
     sizeof(*(ATOMIC_VAL._value)) == 8 ? \
-    _Py_atomic_load_64bit(ATOMIC_VAL._value, ORDER) : \
-    _Py_atomic_load_32bit(ATOMIC_VAL._value, ORDER) \
+    _Py_atomic_load_64bit((volatile long long*)ATOMIC_VAL._value, ORDER) : \
+    _Py_atomic_load_32bit((volatile long*)ATOMIC_VAL._value, ORDER) \
   )
 #elif defined(_M_ARM) || defined(_M_ARM64)
 typedef enum _Py_memory_order {