diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 0ce3b8b5b31d8aa2aacabed691ea382bc98d0793..84b12adbc248baa89ee4878cd6b0bb75173ea1b5 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1200,6 +1200,43 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ requires corresponding C99 library functions to be present.]) fi + # Check for the existence of <complex.h> complex inverse trigonometric + # math functions used by <complex> for C++11 and later. + ac_c99_complex_arc=no; + if test x"$ac_has_complex_h" = x"yes"; then + AC_MSG_CHECKING([for ISO C99 support for inverse trig functions in <complex.h>]) + AC_TRY_COMPILE([#include <complex.h>], + [typedef __complex__ float float_type; float_type tmpf; + cacosf(tmpf); + casinf(tmpf); + catanf(tmpf); + cacoshf(tmpf); + casinhf(tmpf); + catanhf(tmpf); + typedef __complex__ double double_type; double_type tmpd; + cacos(tmpd); + casin(tmpd); + catan(tmpd); + cacosh(tmpd); + casinh(tmpd); + catanh(tmpd); + typedef __complex__ long double ld_type; ld_type tmpld; + cacosl(tmpld); + casinl(tmpld); + catanl(tmpld); + cacoshl(tmpld); + casinhl(tmpld); + catanhl(tmpld); + ],[ac_c99_complex_arc=yes], [ac_c99_complex_arc=no]) + fi + AC_MSG_RESULT($ac_c99_complex_arc) + if test x"$ac_c99_complex_arc" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_ARC, 1, + [Define if C99 inverse trig functions in <complex.h> should be + used in <complex>. Using compiler builtins for these functions + requires corresponding C99 library functions to be present.]) + fi + # Check for the existence in <stdio.h> of vscanf, et. al. AC_CACHE_CHECK([for ISO C99 support in <stdio.h> for C++11], glibcxx_cv_c99_stdio_cxx11, [ diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index a336daf23030e450f7f496f306e5310d7b2547a6..8e037fb13fd76462d59a8de44267e4fb9e62949b 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -892,6 +892,11 @@ <stdio.h>, and <stdlib.h> can be used or exposed. */ #undef _GLIBCXX_USE_C99 +/* Define if C99 inverse trig functions in <complex.h> should be used in + <complex>. Using compiler builtins for these functions requires + corresponding C99 library functions to be present. */ +#undef _GLIBCXX_USE_C99_COMPLEX_ARC + /* Define if C99 functions in <complex.h> should be used in <tr1/complex>. Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index c1faebd54f2f648bd707dfc5ddeee2783d83be1c..04fe6f9ad1cb5d6cdcbcb2134b69bdbf39a501dc 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -18266,6 +18266,59 @@ $as_echo "#define _GLIBCXX11_USE_C99_COMPLEX 1" >>confdefs.h fi + # Check for the existence of <complex.h> complex inverse trigonometric + # math functions used by <complex> for C++11 and later. + ac_c99_complex_arc=no; + if test x"$ac_has_complex_h" = x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support for inverse trig functions in <complex.h>" >&5 +$as_echo_n "checking for ISO C99 support for inverse trig functions in <complex.h>... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <complex.h> +int +main () +{ +typedef __complex__ float float_type; float_type tmpf; + cacosf(tmpf); + casinf(tmpf); + catanf(tmpf); + cacoshf(tmpf); + casinhf(tmpf); + catanhf(tmpf); + typedef __complex__ double double_type; double_type tmpd; + cacos(tmpd); + casin(tmpd); + catan(tmpd); + cacosh(tmpd); + casinh(tmpd); + catanh(tmpd); + typedef __complex__ long double ld_type; ld_type tmpld; + cacosl(tmpld); + casinl(tmpld); + catanl(tmpld); + cacoshl(tmpld); + casinhl(tmpld); + catanhl(tmpld); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_c99_complex_arc=yes +else + ac_c99_complex_arc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_c99_complex_arc" >&5 +$as_echo "$ac_c99_complex_arc" >&6; } + if test x"$ac_c99_complex_arc" = x"yes"; then + +$as_echo "#define _GLIBCXX_USE_C99_COMPLEX_ARC 1" >>confdefs.h + + fi + # Check for the existence in <stdio.h> of vscanf, et. al. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in <stdio.h> for C++11" >&5 $as_echo_n "checking for ISO C99 support in <stdio.h> for C++11... " >&6; } diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index 14981c96f9517c98554b263b35c771d110ead78a..210e13400b98f12f833fee9ab0bf083cc6394510 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -2352,6 +2352,7 @@ PREDEFINED = __cplusplus=202002L \ _GLIBCXX_USE_NOEXCEPT=noexcept \ _GLIBCXX_USE_WCHAR_T \ _GLIBCXX_USE_LONG_LONG \ + _GLIBCXX_USE_C99_COMPLEX_ARC \ _GLIBCXX_USE_C99_STDINT_TR1 \ _GLIBCXX_USE_SCHED_YIELD \ _GLIBCXX_USE_NANOSLEEP \ diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 0f5f14c3ddb750546abdd8ab33817c6de8267d8f..40fc062e53db87baa887545fdbf1b163b304178f 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -2021,7 +2021,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag()); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) inline __complex__ _Float16 __complex_acos(__complex__ _Float16 __z) @@ -2177,7 +2177,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_acos(__complex__ float __z) { return __builtin_cacosf(__z); } @@ -2213,7 +2213,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::complex<_Tp>(__t.imag(), -__t.real()); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_asin(__complex__ float __z) { return __builtin_casinf(__z); } @@ -2257,7 +2257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Tp(0.25) * log(__num / __den)); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_atan(__complex__ float __z) { return __builtin_catanf(__z); } @@ -2293,7 +2293,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0)))); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_acosh(__complex__ float __z) { return __builtin_cacoshf(__z); } @@ -2332,7 +2332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::log(__t + __z); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_asinh(__complex__ float __z) { return __builtin_casinhf(__z); } @@ -2376,7 +2376,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x)); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_atanh(__complex__ float __z) { return __builtin_catanhf(__z); }