[3.11] gh-99337: Fix compile errors with gcc 12 on macOS (GH-99470) (#99638)

gh-99337: Fix compile errors with gcc 12 on macOS (GH-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
(cherry picked from commit cdde29dde9)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
This commit is contained in:
Miss Islington (bot) 2022-11-21 02:22:10 -08:00 committed by GitHub
parent f381644819
commit aa067868ec
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
@ -9817,7 +9829,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.
*/
@ -9832,7 +9844,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
@ -10459,7 +10471,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.
*/
@ -10475,7 +10487,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