gh-99337: Fix compile errors with gcc 12 on macOS (#99470)

Fix a number of compile errors with GCC-12 on macOS:

1. In pylifecycle.c the compile rejects _Pragma within a declaration
2. posixmodule.c was missing a number of ..._RUNTIME macros for non-clang on macOS
3. _ctypes assumed that __builtin_available is always present on macOS
This commit is contained in:
Ronald Oussoren 2022-11-21 10:50:20 +01:00 committed by GitHub
parent 6d8da238cc
commit cdde29dde9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 9 deletions

View file

@ -154,6 +154,18 @@
# define HAVE_SYMLINKAT_RUNTIME (symlinkat != NULL)
# endif
# ifdef HAVE_UTIMENSAT
# define HAVE_UTIMENSAT_RUNTIME (utimensat != NULL)
# endif
# ifdef HAVE_FUTIMENS
# define HAVE_FUTIMENS_RUNTIME (futimens != NULL)
# endif
# ifdef HAVE_PWRITEV
# define HAVE_PWRITEV_RUNTIME (pwritev != NULL)
# endif
#endif
#ifdef HAVE_FUTIMESAT
@ -9838,7 +9850,7 @@ os_preadv_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
} while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
#else
do {
#ifdef __APPLE__
#if defined(__APPLE__) && defined(__clang__)
/* This entire function will be removed from the module dict when the API
* is not available.
*/
@ -9853,7 +9865,7 @@ os_preadv_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
Py_END_ALLOW_THREADS
} while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
#ifdef __APPLE__
#if defined(__APPLE__) && defined(__clang__)
#pragma clang diagnostic pop
#endif
@ -10480,7 +10492,7 @@ os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
} while (result < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
#else
#ifdef __APPLE__
#if defined(__APPLE__) && defined(__clang__)
/* This entire function will be removed from the module dict when the API
* is not available.
*/
@ -10496,7 +10508,7 @@ os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
Py_END_ALLOW_THREADS
} while (result < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
#ifdef __APPLE__
#if defined(__APPLE__) && defined(__clang__)
#pragma clang diagnostic pop
#endif