From 1f378f6dd33ad5067a437d1c456979f8662020d6 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Sat, 13 May 2023 00:57:15 +0100 Subject: libstdc++: Stop using _GLIBCXX_USE_C99_MATH_TR1 in Similar to the three commits r14-908, r14-909 and r14-910, the _GLIBCXX_USE_C99_MATH_TR1 macro is misleading when it is also used for , not only for headers. It is also wrong, because the configure checks for TR1 use -std=c++98 and a target might define the C99 features for C++11 but not for C++98. Add separate configure checks for the functions using -std=c++11 for the checks. Use the new macro defined by those checks in the C++11-specific parts of , and in , etc. The check that defines _GLIBCXX_NO_C99_ROUNDING_FUNCS is only needed for the C++11 checks, so remove that from GLIBCXX_CHECK_C99_TR1 and only do it for GLIBCXX_ENABLE_C99. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_C99): Add checks for C99 math functions and define _GLIBCXX_USE_C99_MATH_FUNCS. Move checks for C99 rounding functions to here. (GLIBCXX_CHECK_C99_TR1): Remove checks for C99 rounding functions from here. * config.h.in: Regenerate. * configure: Regenerate. * include/bits/random.h: Use _GLIBCXX_USE_C99_MATH_FUNCS instead of _GLIBCXX_USE_C99_MATH_TR1. * include/bits/random.tcc: Likewise. * include/c_compatibility/math.h: Likewise. * include/c_global/cmath: Likewise. * include/ext/random: Likewise. * include/ext/random.tcc: Likewise. * include/std/complex: Likewise. * testsuite/20_util/from_chars/4.cc: Likewise. * testsuite/20_util/from_chars/8.cc: Likewise. * testsuite/26_numerics/complex/proj.cc: Likewise. * testsuite/26_numerics/headers/cmath/60401.cc: Likewise. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_cstdint): Likewise. * testsuite/util/testsuite_random.h: Likewise. --- libstdc++-v3/include/ext/random | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libstdc++-v3/include/ext/random') diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 62acb67..5ae085a 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -1116,7 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { result_type __x = this->_M_ndx(__urng); result_type __y = this->_M_ndy(__urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS return std::hypot(__x, __y); #else return std::sqrt(__x * __x + __y * __y); @@ -1132,7 +1132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma()); result_type __x = this->_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS return std::hypot(__x, __y); #else return std::sqrt(__x * __x + __y * __y); -- cgit v1.1