]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/c_global/cmath
libstdc++: Stop using _GLIBCXX_USE_C99_MATH_TR1 in <cmath>
authorJonathan Wakely <jwakely@redhat.com>
Fri, 12 May 2023 23:57:15 +0000 (00:57 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 31 May 2023 20:01:16 +0000 (21:01 +0100)
commit1f378f6dd33ad5067a437d1c456979f8662020d6
tree255394acfc51f529940024c77bebc8c61cc01c32
parentfb409a15d9babc78fe1d9957afcbaf1102cce58f
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.
17 files changed:
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/configure
libstdc++-v3/include/bits/random.h
libstdc++-v3/include/bits/random.tcc
libstdc++-v3/include/c_compatibility/math.h
libstdc++-v3/include/c_global/cmath
libstdc++-v3/include/ext/random
libstdc++-v3/include/ext/random.tcc
libstdc++-v3/include/std/complex
libstdc++-v3/testsuite/20_util/from_chars/4.cc
libstdc++-v3/testsuite/20_util/from_chars/8.cc
libstdc++-v3/testsuite/26_numerics/complex/proj.cc
libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc
libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc
libstdc++-v3/testsuite/lib/libstdc++.exp
libstdc++-v3/testsuite/util/testsuite_random.h