gh-125206: Make _Py_FFI_SUPPORT_C_COMPLEX private (GH-135932)

This commit is contained in:
Petr Viktorin 2025-06-26 11:48:37 +02:00 committed by GitHub
parent 10a3d43188
commit 9193efdeab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 10 deletions

View file

@ -23,7 +23,7 @@
# define _Py_thread_local __thread
#endif
#if defined(Py_FFI_SUPPORT_C_COMPLEX)
#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
# include <complex.h> // csqrt()
# undef I // for _ctypes_test_generated.c.h
#endif
@ -457,7 +457,7 @@ EXPORT(double) my_sqrt(double a)
return sqrt(a);
}
#if defined(Py_FFI_SUPPORT_C_COMPLEX)
#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
EXPORT(double complex) my_csqrt(double complex a)
{
return csqrt(a);

View file

@ -759,7 +759,7 @@ d_get(void *ptr, Py_ssize_t size)
return PyFloat_FromDouble(val);
}
#if defined(Py_FFI_SUPPORT_C_COMPLEX)
#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
/* We don't use _Complex types here, using arrays instead, as the C11+
standard says: "Each complex type has the same representation and alignment
@ -1599,7 +1599,7 @@ for base_code, base_c_type in [
///////////////////////////////////////////////////////////////////////////
TABLE_ENTRY_SW(d, &ffi_type_double);
#if defined(Py_FFI_SUPPORT_C_COMPLEX)
#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
if (Py_FFI_COMPLEX_AVAILABLE) {
TABLE_ENTRY(D, &ffi_type_complex_double);
TABLE_ENTRY(F, &ffi_type_complex_float);

View file

@ -23,7 +23,7 @@
// Do we support C99 complex types in ffi?
// For Apple's libffi, this must be determined at runtime (see gh-128156).
#if defined(Py_FFI_SUPPORT_C_COMPLEX)
#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
# if USING_APPLE_OS_LIBFFI && defined(__has_builtin)
# if __has_builtin(__builtin_available)
# define Py_FFI_COMPLEX_AVAILABLE __builtin_available(macOS 10.15, *)

2
configure generated vendored
View file

@ -15742,7 +15742,7 @@ fi
printf "%s\n" "$ac_cv_ffi_complex_double_supported" >&6; }
if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
printf "%s\n" "#define Py_FFI_SUPPORT_C_COMPLEX 1" >>confdefs.h
printf "%s\n" "#define _Py_FFI_SUPPORT_C_COMPLEX 1" >>confdefs.h
fi

View file

@ -4163,7 +4163,7 @@ int main(void)
[ac_cv_ffi_complex_double_supported=no])
])])
if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
AC_DEFINE([Py_FFI_SUPPORT_C_COMPLEX], [1],
AC_DEFINE([_Py_FFI_SUPPORT_C_COMPLEX], [1],
[Defined if _Complex C type can be used with libffi.])
fi

View file

@ -1736,9 +1736,6 @@
/* Defined if Python is built as a shared library. */
#undef Py_ENABLE_SHARED
/* Defined if _Complex C type can be used with libffi. */
#undef Py_FFI_SUPPORT_C_COMPLEX
/* Define if you want to disable the GIL */
#undef Py_GIL_DISABLED
@ -2026,6 +2023,9 @@
/* Maximum length in bytes of a thread name */
#undef _PYTHREAD_NAME_MAXLEN
/* Defined if _Complex C type can be used with libffi. */
#undef _Py_FFI_SUPPORT_C_COMPLEX
/* Define to force use of thread-safe errno, h_errno, and other functions */
#undef _REENTRANT