--- /dev/null
+Fix a compilation issue with GCC 12 on macOS.
"ffi_prep_cif failed with %d", result);
goto error;
}
+
+
#if HAVE_FFI_PREP_CLOSURE_LOC
# ifdef USING_APPLE_OS_LIBFFI
+# ifdef HAVE_BUILTIN_AVAILABLE
# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
+# else
+# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME (ffi_prep_closure_loc != NULL)
+# endif
# else
# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME 1
# endif
#define CTYPES_CAPSULE_NAME_PYMEM "_ctypes pymem"
+
static void pymem_destructor(PyObject *ptr)
{
void *p = PyCapsule_GetPointer(ptr, CTYPES_CAPSULE_NAME_PYMEM);
#endif
# ifdef USING_APPLE_OS_LIBFFI
+# ifdef HAVE_BUILTIN_AVAILABLE
# define HAVE_FFI_PREP_CIF_VAR_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
+# else
+# define HAVE_FFI_PREP_CIF_VAR_RUNTIME (ffi_prep_cif_var != NULL)
+# endif
# elif HAVE_FFI_PREP_CIF_VAR
# define HAVE_FFI_PREP_CIF_VAR_RUNTIME true
# else
#else
#ifdef __APPLE__
#ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
-#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME \
- __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)
+# ifdef HAVE_BUILTIN_AVAILABLE
+# define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME \
+ __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)
+# else
+# define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME \
+ (_dyld_shared_cache_contains_path != NULL)
+# endif
#else
// Support the deprecated case of compiling on an older macOS version
static void *libsystem_b_handle;
#endif
#endif
+#if defined(__has_builtin)
+#if __has_builtin(__builtin_available)
+#define HAVE_BUILTIN_AVAILABLE 1
+#endif
+#endif
+
typedef struct tagPyCArgObject PyCArgObject;
typedef struct tagCDataObject CDataObject;
typedef PyObject *(* GETFUNC)(void *, Py_ssize_t size);
/* #define MALLOC_CLOSURE_DEBUG */ /* enable for some debugging output */
+
/******************************************************************/
typedef union _tagITEM {
{
#ifdef HAVE_FFI_CLOSURE_ALLOC
#ifdef USING_APPLE_OS_LIBFFI
+# ifdef HAVE_BUILTIN_AVAILABLE
if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
+# else
+ if (ffi_closure_free != NULL) {
+# endif
#endif
ffi_closure_free(p);
return;
{
#ifdef HAVE_FFI_CLOSURE_ALLOC
#ifdef USING_APPLE_OS_LIBFFI
+# ifdef HAVE_BUILTIN_AVAILABLE
if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
+# else
+ if (ffi_closure_alloc != NULL) {
+# endif
#endif
return ffi_closure_alloc(size, codeloc);
#ifdef USING_APPLE_OS_LIBFFI
# 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
} 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.
*/
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
} 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.
*/
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
* interpreter state for various runtime debugging tools, but is *not* an
* officially supported feature */
+/* Suppress deprecation warning for PyBytesObject.ob_shash */
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+
#if defined(MS_WINDOWS)
#pragma section("PyRuntime", read, write)
#endif
-/* Suppress deprecation warning for PyBytesObject.ob_shash */
-_Py_COMP_DIAG_PUSH
-_Py_COMP_DIAG_IGNORE_DEPR_DECLS
_PyRuntimeState _PyRuntime
#if defined(__linux__) && (defined(__GNUC__) || defined(__clang__))
__attribute__ ((section (".PyRuntime")))