public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [libstdc++] [testsuite] require cmath for c++23 cmath tests
@ 2024-06-12  1:16 Alexandre Oliva
  2024-06-12  7:20 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 2024-06-12  1:16 UTC (permalink / raw)
  To: gcc-patches, libstdc++


Some c++23 tests fail on targets that don't satisfy dg-require-cmath,
because referenced math functions don't get declared in std.  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?


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [libstdc++] [testsuite] require cmath for c++23 cmath tests
  2024-06-12  1:16 [PATCH] [libstdc++] [testsuite] require cmath for c++23 cmath tests Alexandre Oliva
@ 2024-06-12  7:20 ` Jonathan Wakely
  2024-06-12 22:43   ` Alexandre Oliva
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2024-06-12  7:20 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches, libstdc++

[-- Attachment #1: Type: text/plain, Size: 3021 bytes --]

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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [libstdc++] [testsuite] require cmath for c++23 cmath tests
  2024-06-12  7:20 ` Jonathan Wakely
@ 2024-06-12 22:43   ` Alexandre Oliva
  2024-06-13 10:35     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 2024-06-12 22:43 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-patches, libstdc++

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?

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [libstdc++] [testsuite] require cmath for c++23 cmath tests
  2024-06-12 22:43   ` Alexandre Oliva
@ 2024-06-13 10:35     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2024-06-13 10:35 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Jonathan Wakely, gcc-patches, libstdc++

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-13 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-12  1:16 [PATCH] [libstdc++] [testsuite] require cmath for c++23 cmath tests Alexandre Oliva
2024-06-12  7:20 ` Jonathan Wakely
2024-06-12 22:43   ` Alexandre Oliva
2024-06-13 10:35     ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).