Message ID | orv82fhseq.fsf@lxoliva.fsfla.org |
---|---|
State | New |
Headers | show |
Series | [libstdc++,testsuite] require cmath for c++23 cmath tests | expand |
On Wed, 12 Jun 2024, 02:17 Alexandre Oliva, <oliva@adacore.com> wrote: > > Some c++23 tests fail on targets that don't satisfy dg-require-cmath, > because referenced math functions don't get declared in std. Are they present on the target at all? Is not declaring them in std the underlying bug here? Add the > missing requirement. > > Regstrapping on x86_64-linux-gnu. Already successfully tested with > gcc-13 on aarch64-rtems, where it avoids the errors that come up because > math.h doesn't meet the cmath requirements there. Ok to install? > OK > > for libstdc++-v3/ChangeLog > > * testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc: > Require cmath. > * testsuite/26_numerics/headers/cmath/functions_std_c++23.cc: > Likewise. > * testsuite/26_numerics/headers/cmath/nextafter_std_c++23.cc: > Likewise. > --- > .../headers/cmath/constexpr_std_c++23.cc | 1 + > .../headers/cmath/functions_std_c++23.cc | 1 + > .../26_numerics/headers/cmath/nextafter_c++23.cc | 1 + > 3 files changed, 3 insertions(+) > > diff --git > a/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc > b/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc > index 0e3d112fe2e80..3c2377fd6987b 100644 > --- > a/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc > +++ > b/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc > @@ -16,6 +16,7 @@ > // <http://www.gnu.org/licenses/>. > > // { dg-do link { target c++23 } } > +// { dg-require-cmath "" } > > #include <stdfloat> > #include <cmath> > diff --git > a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc > b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc > index 000cebf364aaa..ea68ac5da7551 100644 > --- > a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc > +++ > b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc > @@ -16,6 +16,7 @@ > // <http://www.gnu.org/licenses/>. > > // { dg-do link { target c++23 } } > +// { dg-require-cmath "" } > > #include <stdfloat> > #include <cmath> > diff --git > a/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc > b/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc > index 7d7e10bd8aea3..91767d22cc3f2 100644 > --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc > +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc > @@ -16,6 +16,7 @@ > // <http://www.gnu.org/licenses/>. > > // { dg-do run { target c++23 } } > +// { dg-require-cmath "" } > > #include <stdfloat> > #include <cmath> > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > More tolerance and less prejudice are key for inclusion and diversity > Excluding neuro-others for not behaving ""normal"" is *not* inclusive >
On Jun 12, 2024, Jonathan Wakely <jwakely.gcc@gmail.com> wrote: > On Wed, 12 Jun 2024, 02:17 Alexandre Oliva, <oliva@adacore.com> wrote: >> >> Some c++23 tests fail on targets that don't satisfy dg-require-cmath, >> because referenced math functions don't get declared in std. > Are they present on the target at all? Is not declaring them in std the > underlying bug here? Some are present on the target, but the <cmath> implementation doesn't bring them into std because the detection for them in libc concludes the feature is not available. Should they be declared even if using them would cause link errors? Or should libstdc++ offer additional fallback implementations?
On Wed, 12 Jun 2024 at 23:44, Alexandre Oliva <oliva@adacore.com> wrote: > > On Jun 12, 2024, Jonathan Wakely <jwakely.gcc@gmail.com> wrote: > > > On Wed, 12 Jun 2024, 02:17 Alexandre Oliva, <oliva@adacore.com> wrote: > >> > >> Some c++23 tests fail on targets that don't satisfy dg-require-cmath, > >> because referenced math functions don't get declared in std. > > > Are they present on the target at all? Is not declaring them in std the > > underlying bug here? > > Some are present on the target, but the <cmath> implementation doesn't > bring them into std because the detection for them in libc concludes the > feature is not available. > > Should they be declared even if using them would cause link errors? Or > should libstdc++ offer additional fallback implementations? I guess that's a target maintainer's choice. I'm fine with just skipping the tests. If no users are asking for those features, it also seems fine to not declare them.
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc index 0e3d112fe2e80..3c2377fd6987b 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/constexpr_std_c++23.cc @@ -16,6 +16,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do link { target c++23 } } +// { dg-require-cmath "" } #include <stdfloat> #include <cmath> diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc index 000cebf364aaa..ea68ac5da7551 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++23.cc @@ -16,6 +16,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do link { target c++23 } } +// { dg-require-cmath "" } #include <stdfloat> #include <cmath> diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc index 7d7e10bd8aea3..91767d22cc3f2 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/nextafter_c++23.cc @@ -16,6 +16,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do run { target c++23 } } +// { dg-require-cmath "" } #include <stdfloat> #include <cmath>