aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-05-13 00:57:15 +0100
committerJonathan Wakely <jwakely@redhat.com>2023-05-31 21:01:16 +0100
commit1f378f6dd33ad5067a437d1c456979f8662020d6 (patch)
tree255394acfc51f529940024c77bebc8c61cc01c32 /libstdc++-v3/include
parentfb409a15d9babc78fe1d9957afcbaf1102cce58f (diff)
downloadgcc-1f378f6dd33ad5067a437d1c456979f8662020d6.zip
gcc-1f378f6dd33ad5067a437d1c456979f8662020d6.tar.gz
gcc-1f378f6dd33ad5067a437d1c456979f8662020d6.tar.bz2
libstdc++: Stop using _GLIBCXX_USE_C99_MATH_TR1 in <cmath>
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 <cmath>, not only for <tr1/cmath> 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 <math.h> functions using -std=c++11 for the checks. Use the new macro defined by those checks in the C++11-specific parts of <cmath>, and in <complex>, <random> etc. The check that defines _GLIBCXX_NO_C99_ROUNDING_FUNCS is only needed for the C++11 <cmath> 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.
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/random.h12
-rw-r--r--libstdc++-v3/include/bits/random.tcc14
-rw-r--r--libstdc++-v3/include/c_compatibility/math.h4
-rw-r--r--libstdc++-v3/include/c_global/cmath4
-rw-r--r--libstdc++-v3/include/ext/random4
-rw-r--r--libstdc++-v3/include/ext/random.tcc6
-rw-r--r--libstdc++-v3/include/std/complex2
7 files changed, 23 insertions, 23 deletions
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index f77005a..58b5dd7 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -3901,7 +3901,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
double _M_p;
double _M_q;
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
_M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
#endif
@@ -4015,7 +4015,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const binomial_distribution& __d1,
const binomial_distribution& __d2)
-#ifdef _GLIBCXX_USE_C99_MATH_TR1
+#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
{ return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
#else
{ return __d1._M_param == __d2._M_param; }
@@ -4068,7 +4068,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
param_type _M_param;
- // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+ // NB: Unused when _GLIBCXX_USE_C99_MATH_FUNCS is undefined.
std::normal_distribution<double> _M_nd;
};
@@ -4595,7 +4595,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
double _M_mean;
double _M_lm_thr;
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
#endif
};
@@ -4700,7 +4700,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const poisson_distribution& __d1,
const poisson_distribution& __d2)
-#ifdef _GLIBCXX_USE_C99_MATH_TR1
+#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
{ return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
#else
{ return __d1._M_param == __d2._M_param; }
@@ -4746,7 +4746,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
param_type _M_param;
- // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+ // NB: Unused when _GLIBCXX_USE_C99_MATH_FUNCS is undefined.
std::normal_distribution<double> _M_nd;
};
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
index f092b5c..24a5987 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -1267,7 +1267,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
poisson_distribution<_IntType>::param_type::
_M_initialize()
{
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
if (_M_mean >= 12)
{
const double __m = std::floor(_M_mean);
@@ -1295,7 +1295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* A rejection algorithm when mean >= 12 and a simple method based
* upon the multiplication of uniform random variates otherwise.
- * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
+ * NB: The former is available only if _GLIBCXX_USE_C99_MATH_FUNCS
* is defined.
*
* Reference:
@@ -1311,7 +1311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
__detail::_Adaptor<_UniformRandomNumberGenerator, double>
__aurng(__urng);
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
if (__param.mean() >= 12)
{
double __x;
@@ -1479,7 +1479,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_easy = true;
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
if (_M_t * __p12 >= 8)
{
_M_easy = false;
@@ -1550,7 +1550,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* A rejection algorithm when t * p >= 8 and a simple waiting time
* method - the second in the referenced book - otherwise.
- * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
+ * NB: The former is available only if _GLIBCXX_USE_C99_MATH_FUNCS
* is defined.
*
* Reference:
@@ -1571,7 +1571,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__detail::_Adaptor<_UniformRandomNumberGenerator, double>
__aurng(__urng);
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
if (!__param._M_easy)
{
double __x;
@@ -3367,7 +3367,7 @@ namespace __detail
__ret = __sum / __tmp;
if (__builtin_expect(__ret >= _RealType(1), 0))
{
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
__ret = std::nextafter(_RealType(1), _RealType(0));
#else
__ret = _RealType(1)
diff --git a/libstdc++-v3/include/c_compatibility/math.h b/libstdc++-v3/include/c_compatibility/math.h
index 1206117..cedb11d 100644
--- a/libstdc++-v3/include/c_compatibility/math.h
+++ b/libstdc++-v3/include/c_compatibility/math.h
@@ -74,7 +74,7 @@ using std::islessgreater;
using std::isunordered;
#endif
-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_TR1)
+#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_FUNCS)
using std::acosh;
using std::asinh;
using std::atanh;
@@ -109,7 +109,7 @@ using std::scalbln;
using std::scalbn;
using std::tgamma;
using std::trunc;
-#endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1
+#endif // C++11 && _GLIBCXX_USE_C99_MATH_FUNCS
// The mathematical special functions are only added to the global namespace
// by IS 29124, but not by C++17.
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 4dc029e..c80ee7c 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -1767,7 +1767,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L
-#ifdef _GLIBCXX_USE_C99_MATH_TR1
+#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
#undef acosh
#undef acoshf
@@ -3539,7 +3539,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
-#endif // _GLIBCXX_USE_C99_MATH_TR1
+#endif // _GLIBCXX_USE_C99_MATH_FUNCS
#endif // C++11
#if __cplusplus >= 201703L
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);
diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc
index df80422..87ecce7 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -740,7 +740,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
*__f++ = std::hypot(__x, __y);
#else
*__f++ = std::sqrt(__x * __x + __y * __y);
@@ -1287,7 +1287,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
result_type __res = std::acos(__f);
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
__res = std::copysign(__res, __aurng() - result_type(0.5));
#else
if (__aurng() < result_type(0.5))
@@ -1623,7 +1623,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
while (__sq == _RealType(0) || __sq > _RealType(1));
-#if _GLIBCXX_USE_C99_MATH_TR1
+#if _GLIBCXX_USE_C99_MATH_FUNCS
// Yes, we do not just use sqrt(__sq) because hypot() is more
// accurate.
auto __norm = std::hypot(__ret[0], __ret[1]);
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 40fc062..f01a3af 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -2534,7 +2534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __complex_proj(__z.__rep()); }
#endif
-#elif defined _GLIBCXX_USE_C99_MATH_TR1
+#elif defined _GLIBCXX_USE_C99_MATH_FUNCS
inline complex<float>
__complex_proj(const complex<float>& __z)
{