From 92c89f8e693775bf7f3948db80384891cefce402 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 5 May 2025 15:55:34 +0300 Subject: [PATCH] gh-61103: drop unused Py_HAVE_C_COMPLEX define The Py_FFI_SUPPORT_C_COMPLEX check configure check imply support for complex types. --- Modules/_ctypes/_ctypes_test.c | 4 +-- configure | 47 ---------------------------------- configure.ac | 29 --------------------- pyconfig.h.in | 3 --- 4 files changed, 2 insertions(+), 81 deletions(-) diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 557bfa85b1ea29..d28e5708b44933 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -23,7 +23,7 @@ # define _Py_thread_local __thread #endif -#if defined(Py_HAVE_C_COMPLEX) && defined(Py_FFI_SUPPORT_C_COMPLEX) +#if defined(Py_FFI_SUPPORT_C_COMPLEX) # include // 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_HAVE_C_COMPLEX) && defined(Py_FFI_SUPPORT_C_COMPLEX) +#if defined(Py_FFI_SUPPORT_C_COMPLEX) EXPORT(double complex) my_csqrt(double complex a) { return csqrt(a); diff --git a/configure b/configure index 1f425c02a55156..a1069509406a34 100755 --- a/configure +++ b/configure @@ -14654,53 +14654,6 @@ printf "%s\n" "$AIX_BUILDDATE" >&6; } *) ;; esac -# check for _Complex C type -# -# Note that despite most compilers define __STDC_IEC_559_COMPLEX__ - almost -# none properly support C11+ Annex G (where pure imaginary types -# represented by _Imaginary are mandatory). This is a bug (see e.g. -# llvm/llvm-project#60269), so we don't rely on presence -# of __STDC_IEC_559_COMPLEX__. -if test "$cross_compiling" = yes -then : - ac_cv_c_complex_supported=no -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#define test(type, out) \ -{ \ - type complex z = 1 + 2*I; z = z*z; \ - (out) = (out) || creal(z) != -3 || cimag(z) != 4; \ -} -int main(void) -{ - int res = 0; - test(float, res); - test(double, res); - test(long double, res); - return res; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - ac_cv_c_complex_supported=yes -else case e in #( - e) ac_cv_c_complex_supported=no ;; -esac -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac -fi - -if test "$ac_cv_c_complex_supported" = "yes"; then - -printf "%s\n" "#define Py_HAVE_C_COMPLEX 1" >>confdefs.h - -fi - # check for systems that require aligned memory access { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking aligned memory access is required" >&5 printf %s "checking aligned memory access is required... " >&6; } diff --git a/configure.ac b/configure.ac index 96b157a13e88db..4efd0328691d19 100644 --- a/configure.ac +++ b/configure.ac @@ -3838,35 +3838,6 @@ dnl The AIX_BUILDDATE is obtained from the kernel fileset - bos.mp64 *) ;; esac -# check for _Complex C type -# -# Note that despite most compilers define __STDC_IEC_559_COMPLEX__ - almost -# none properly support C11+ Annex G (where pure imaginary types -# represented by _Imaginary are mandatory). This is a bug (see e.g. -# llvm/llvm-project#60269), so we don't rely on presence -# of __STDC_IEC_559_COMPLEX__. -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#define test(type, out) \ -{ \ - type complex z = 1 + 2*I; z = z*z; \ - (out) = (out) || creal(z) != -3 || cimag(z) != 4; \ -} -int main(void) -{ - int res = 0; - test(float, res); - test(double, res); - test(long double, res); - return res; -}]])], [ac_cv_c_complex_supported=yes], -[ac_cv_c_complex_supported=no], -[ac_cv_c_complex_supported=no]) -if test "$ac_cv_c_complex_supported" = "yes"; then - AC_DEFINE([Py_HAVE_C_COMPLEX], [1], - [Defined if _Complex C type is available.]) -fi - # check for systems that require aligned memory access AC_CACHE_CHECK([aligned memory access is required], [ac_cv_aligned_required], [AC_RUN_IFELSE([AC_LANG_SOURCE([[ diff --git a/pyconfig.h.in b/pyconfig.h.in index 8c2c6ab5cea4cd..c91facbedf94e5 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1730,9 +1730,6 @@ SipHash13: 3, externally defined: 0 */ #undef Py_HASH_ALGORITHM -/* Defined if _Complex C type is available. */ -#undef Py_HAVE_C_COMPLEX - /* Define if year with century should be normalized for strftime. */ #undef Py_NORMALIZE_CENTURY