GCC warnings on pycore_semaphore.h and Python/parking_lot.c · Issue #110014 · python/cpython (original) (raw)
Building the Python main branch on RHEL8 with gcc -Og -flto
(GCC 8.5.0 on ppc64le) emits the following compiler warnings:
./Include/internal/pycore_semaphore.h:54:1: warning: type of ‘_PySemaphore_Wakeup’ does not match original declaration [-Wlto-type-mismatch]
_PySemaphore_Wakeup(_PySemaphore *sema);
^
Python/parking_lot.c:197:1: note: ‘_PySemaphore_Wakeup’ was previously declared here
_PySemaphore_Wakeup(_PySemaphore *sema)
^
Python/parking_lot.c:197:1: note: code may be misoptimized unless -fno-strict-aliasing is used
./Include/internal/pycore_semaphore.h:57:18: warning: type of ‘_PySemaphore_Init’ does not match original declaration [-Wlto-type-mismatch]
PyAPI_FUNC(void) _PySemaphore_Init(_PySemaphore *sema);
^
Python/parking_lot.c:53:1: note: ‘_PySemaphore_Init’ was previously declared here
_PySemaphore_Init(_PySemaphore *sema)
^
Python/parking_lot.c:53:1: note: code may be misoptimized unless -fno-strict-aliasing is used
./Include/internal/pycore_semaphore.h:49:1: warning: type of ‘_PySemaphore_Wait’ does not match original declaration [-Wlto-type-mismatch]
_PySemaphore_Wait(_PySemaphore *sema, _PyTime_t timeout_ns, int detach);
^
Python/parking_lot.c:178:1: note: ‘_PySemaphore_Wait’ was previously declared here
_PySemaphore_Wait(_PySemaphore *sema, _PyTime_t timeout, int detach)
^
Python/parking_lot.c:178:1: note: code may be misoptimized unless -fno-strict-aliasing is used
./Include/internal/pycore_semaphore.h:58:18: warning: type of ‘_PySemaphore_Destroy’ does not match original declaration [-Wlto-type-mismatch]
PyAPI_FUNC(void) _PySemaphore_Destroy(_PySemaphore *sema);
^
Python/parking_lot.c:81:1: note: ‘_PySemaphore_Destroy’ was previously declared here
_PySemaphore_Destroy(_PySemaphore *sema)
^
Python/parking_lot.c:81:1: note: code may be misoptimized unless -fno-strict-aliasing is used
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
cc @colesbury @ericsnowcurrently
Linked PRs
- gh-110014: Fix inconsistent struct definition in pycore_semaphore.h #110030
- gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage #110139
- gh-110014: Include explicitly <unistd.h> header #110155
- gh-110014: Fix bootstrap_hash.h: remove debug code #110161
- gh-110014: Remove PY_TIMEOUT_MAX from limited C API #110217