[issue26161] Use Py_uintptr_t instead of void* for atomic pointers
STINNER Victor
report at bugs.python.org
Wed Jan 20 05:57:13 EST 2016
New submission from STINNER Victor:
Attached patch fixes compiler warnings on atomic pointers.
Python has 4 implementations of atomic types:
* <stdatomic.h>
* GCC 4.7+ builtin atomic operations
* GCC x86 and x86_64 assembler
* volatile
The type of atomic pointers changes depending on the implementation. Attached patch changes the _Py_atomic_address to use atomic_uintptr_t (<stdatomic.h>) or Py_uintptr_t type internally.
The patchs also adds GET_TSTATE(), SET_TSTATE() and GET_INTERP_STATE() macros in pystate.c to make the code more readable.
This issue is a follow up of the issue #22038 which added support for <stdatomic.h> in Python/pyatomic.h. See also issues #23644 (compilation issue with g++), #25150 (compilation issue with OpenMP) and #26154 (add _PyThreadState_UncheckedGet()).
I would be "nice" to backport this change to Python 3.5.2 to fix the compiler warning, but I'm not 100% confident that my patch works on all compilers and all platforms. Maybe it's better to "experiment" it only in Python 3.6.
Note: I copied the nosy list of the issue #22038 since this one is a follow up.
----------
components: Interpreter Core
files: atomic_pointer.patch
keywords: patch
messages: 258661
nosy: Arfrever, John.Malmberg, Vitor.de.Lima, fijall, gustavotemple, haypo, koobs, lbianc, neologix
priority: normal
severity: normal
status: open
title: Use Py_uintptr_t instead of void* for atomic pointers
versions: Python 3.6
Added file: http://bugs.python.org/file41667/atomic_pointer.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26161>
_______________________________________
More information about the Python-bugs-list
mailing list