public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
@ 2023-02-20 11:23 Nathaniel Shead
  2023-02-20 11:30 ` Jonathan Wakely
  0 siblings, 1 reply; 12+ messages in thread
From: Nathaniel Shead @ 2023-02-20 11:23 UTC (permalink / raw)
  To: libstdc++, gcc-patches

The comments on PR79700 mentioned that it was somewhat ambiguous whether
these functions were supposed to exist for C++11 or not. I chose to add
them there, since other resources (such as cppreference) seem to think
that C++11 should be the standard these functions were introduced, and I
don't know of any reason to do otherwise.

Tested on x86_64-linux.

-- 8< --

This patch adds the -f and -l variants of the C89 <math.h> functions to
<cmath> under namespace std (so std::sqrtf, std::fabsl, etc.) for C++11
and up.

libstdc++-v3/ChangeLog:

	PR libstdc++/79700
	* include/c_global/cmath (acosf, acosl, asinf, asinl, atanf,
        atanl, atan2f, atan2l, ceilf, ceill, cosf, cosl, coshf, coshl,
        expf, expl, fabsf, fabsl, floorf, floorl, fmodf, fmodl, frexpf,
        frexpl, ldexpf, ldexpl, logf, logl, log10f, log10l, modff,
        modfl, powf, powl, sinf, sinl, sinhf, sinhl, sqrtf, sqrtl, tanf,
        tanl, tanhf, tanhl): Add aliases in namespace std.
	* testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
        Add checks for existence of above names.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
---
 libstdc++-v3/include/c_global/cmath           | 111 ++++++++++++++++++
 .../headers/cmath/functions_std_c++17.cc      |  45 +++++++
 2 files changed, 156 insertions(+)

diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 568eb354c2d..eaebde33dee 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -1767,6 +1767,117 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus >= 201103L
 
+#undef acosf
+#undef acosl
+#undef asinf
+#undef asinl
+#undef atanf
+#undef atanl
+#undef atan2f
+#undef atan2l
+#undef ceilf
+#undef ceill
+#undef cosf
+#undef cosl
+#undef coshf
+#undef coshl
+#undef expf
+#undef expl
+#undef fabsf
+#undef fabsl
+#undef floorf
+#undef floorl
+#undef fmodf
+#undef fmodl
+#undef frexpf
+#undef frexpl
+#undef ldexpf
+#undef ldexpl
+#undef logf
+#undef logl
+#undef log10f
+#undef log10l
+#undef modff
+#undef modfl
+#undef powf
+#undef powl
+#undef sinf
+#undef sinl
+#undef sinhf
+#undef sinhl
+#undef sqrtf
+#undef sqrtl
+#undef tanf
+#undef tanl
+#undef tanhf
+#undef tanhl
+
+  using ::acosf;
+  using ::acosl;
+
+  using ::asinf;
+  using ::asinl;
+
+  using ::atanf;
+  using ::atanl;
+
+  using ::atan2f;
+  using ::atan2l;
+
+  using ::ceilf;
+  using ::ceill;
+
+  using ::cosf;
+  using ::cosl;
+
+  using ::coshf;
+  using ::coshl;
+
+  using ::expf;
+  using ::expl;
+
+  using ::fabsf;
+  using ::fabsl;
+
+  using ::floorf;
+  using ::floorl;
+
+  using ::fmodf;
+  using ::fmodl;
+
+  using ::frexpf;
+  using ::frexpl;
+
+  using ::ldexpf;
+  using ::ldexpl;
+
+  using ::logf;
+  using ::logl;
+
+  using ::log10f;
+  using ::log10l;
+
+  using ::modff;
+  using ::modfl;
+
+  using ::powf;
+  using ::powl;
+
+  using ::sinf;
+  using ::sinl;
+
+  using ::sinhf;
+  using ::sinhl;
+
+  using ::sqrtf;
+  using ::sqrtl;
+
+  using ::tanf;
+  using ::tanl;
+
+  using ::tanhf;
+  using ::tanhl;
+
 #ifdef _GLIBCXX_USE_C99_MATH_TR1
 
 #undef acosh
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
index 3b4ada1a756..c6ec636c183 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
@@ -44,6 +44,51 @@ namespace gnu
   using std::tan;
   using std::tanh;
 
+  using std::acosf;
+  using std::acosl;
+  using std::asinf;
+  using std::asinl;
+  using std::atanf;
+  using std::atanl;
+  using std::atan2f;
+  using std::atan2l;
+  using std::ceilf;
+  using std::ceill;
+  using std::cosf;
+  using std::cosl;
+  using std::coshf;
+  using std::coshl;
+  using std::expf;
+  using std::expl;
+  using std::fabsf;
+  using std::fabsl;
+  using std::floorf;
+  using std::floorl;
+  using std::fmodf;
+  using std::fmodl;
+  using std::frexpf;
+  using std::frexpl;
+  using std::ldexpf;
+  using std::ldexpl;
+  using std::logf;
+  using std::logl;
+  using std::log10f;
+  using std::log10l;
+  using std::modff;
+  using std::modfl;
+  using std::powf;
+  using std::powl;
+  using std::sinf;
+  using std::sinl;
+  using std::sinhf;
+  using std::sinhl;
+  using std::sqrtf;
+  using std::sqrtl;
+  using std::tanf;
+  using std::tanl;
+  using std::tanhf;
+  using std::tanhl;
+
   using std::assoc_laguerre;
   using std::assoc_laguerref;
   using std::assoc_laguerrel;
-- 
2.34.1


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

* Re: [PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-02-20 11:23 [PATCH] libstdc++: Add missing functions to <cmath> [PR79700] Nathaniel Shead
@ 2023-02-20 11:30 ` Jonathan Wakely
  2023-02-20 11:57   ` Nathaniel Shead
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Wakely @ 2023-02-20 11:30 UTC (permalink / raw)
  To: Nathaniel Shead; +Cc: libstdc++, gcc-patches

On Mon, 20 Feb 2023 at 11:23, Nathaniel Shead via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> The comments on PR79700 mentioned that it was somewhat ambiguous whether
> these functions were supposed to exist for C++11 or not. I chose to add
> them there, since other resources (such as cppreference) seem to think
> that C++11 should be the standard these functions were introduced, and I
> don't know of any reason to do otherwise.
>
> Tested on x86_64-linux.

Thanks for the patch, but this needs tests for the new declarations
(which are tedious to write, which is the main reason I haven't
already pushed my own very similar patch).


>
> -- 8< --
>
> This patch adds the -f and -l variants of the C89 <math.h> functions to
> <cmath> under namespace std (so std::sqrtf, std::fabsl, etc.) for C++11
> and up.
>
> libstdc++-v3/ChangeLog:
>
>         PR libstdc++/79700
>         * include/c_global/cmath (acosf, acosl, asinf, asinl, atanf,
>         atanl, atan2f, atan2l, ceilf, ceill, cosf, cosl, coshf, coshl,
>         expf, expl, fabsf, fabsl, floorf, floorl, fmodf, fmodl, frexpf,
>         frexpl, ldexpf, ldexpl, logf, logl, log10f, log10l, modff,
>         modfl, powf, powl, sinf, sinl, sinhf, sinhl, sqrtf, sqrtl, tanf,
>         tanl, tanhf, tanhl): Add aliases in namespace std.
>         * testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
>         Add checks for existence of above names.
>
> Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
> ---
>  libstdc++-v3/include/c_global/cmath           | 111 ++++++++++++++++++
>  .../headers/cmath/functions_std_c++17.cc      |  45 +++++++
>  2 files changed, 156 insertions(+)
>
> diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
> index 568eb354c2d..eaebde33dee 100644
> --- a/libstdc++-v3/include/c_global/cmath
> +++ b/libstdc++-v3/include/c_global/cmath
> @@ -1767,6 +1767,117 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
>  #if __cplusplus >= 201103L
>
> +#undef acosf
> +#undef acosl
> +#undef asinf
> +#undef asinl
> +#undef atanf
> +#undef atanl
> +#undef atan2f
> +#undef atan2l
> +#undef ceilf
> +#undef ceill
> +#undef cosf
> +#undef cosl
> +#undef coshf
> +#undef coshl
> +#undef expf
> +#undef expl
> +#undef fabsf
> +#undef fabsl
> +#undef floorf
> +#undef floorl
> +#undef fmodf
> +#undef fmodl
> +#undef frexpf
> +#undef frexpl
> +#undef ldexpf
> +#undef ldexpl
> +#undef logf
> +#undef logl
> +#undef log10f
> +#undef log10l
> +#undef modff
> +#undef modfl
> +#undef powf
> +#undef powl
> +#undef sinf
> +#undef sinl
> +#undef sinhf
> +#undef sinhl
> +#undef sqrtf
> +#undef sqrtl
> +#undef tanf
> +#undef tanl
> +#undef tanhf
> +#undef tanhl
> +
> +  using ::acosf;
> +  using ::acosl;
> +
> +  using ::asinf;
> +  using ::asinl;
> +
> +  using ::atanf;
> +  using ::atanl;
> +
> +  using ::atan2f;
> +  using ::atan2l;
> +
> +  using ::ceilf;
> +  using ::ceill;
> +
> +  using ::cosf;
> +  using ::cosl;
> +
> +  using ::coshf;
> +  using ::coshl;
> +
> +  using ::expf;
> +  using ::expl;
> +
> +  using ::fabsf;
> +  using ::fabsl;
> +
> +  using ::floorf;
> +  using ::floorl;
> +
> +  using ::fmodf;
> +  using ::fmodl;
> +
> +  using ::frexpf;
> +  using ::frexpl;
> +
> +  using ::ldexpf;
> +  using ::ldexpl;
> +
> +  using ::logf;
> +  using ::logl;
> +
> +  using ::log10f;
> +  using ::log10l;
> +
> +  using ::modff;
> +  using ::modfl;
> +
> +  using ::powf;
> +  using ::powl;
> +
> +  using ::sinf;
> +  using ::sinl;
> +
> +  using ::sinhf;
> +  using ::sinhl;
> +
> +  using ::sqrtf;
> +  using ::sqrtl;
> +
> +  using ::tanf;
> +  using ::tanl;
> +
> +  using ::tanhf;
> +  using ::tanhl;
> +
>  #ifdef _GLIBCXX_USE_C99_MATH_TR1
>
>  #undef acosh
> diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> index 3b4ada1a756..c6ec636c183 100644
> --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> @@ -44,6 +44,51 @@ namespace gnu
>    using std::tan;
>    using std::tanh;
>
> +  using std::acosf;
> +  using std::acosl;
> +  using std::asinf;
> +  using std::asinl;
> +  using std::atanf;
> +  using std::atanl;
> +  using std::atan2f;
> +  using std::atan2l;
> +  using std::ceilf;
> +  using std::ceill;
> +  using std::cosf;
> +  using std::cosl;
> +  using std::coshf;
> +  using std::coshl;
> +  using std::expf;
> +  using std::expl;
> +  using std::fabsf;
> +  using std::fabsl;
> +  using std::floorf;
> +  using std::floorl;
> +  using std::fmodf;
> +  using std::fmodl;
> +  using std::frexpf;
> +  using std::frexpl;
> +  using std::ldexpf;
> +  using std::ldexpl;
> +  using std::logf;
> +  using std::logl;
> +  using std::log10f;
> +  using std::log10l;
> +  using std::modff;
> +  using std::modfl;
> +  using std::powf;
> +  using std::powl;
> +  using std::sinf;
> +  using std::sinl;
> +  using std::sinhf;
> +  using std::sinhl;
> +  using std::sqrtf;
> +  using std::sqrtl;
> +  using std::tanf;
> +  using std::tanl;
> +  using std::tanhf;
> +  using std::tanhl;
> +
>    using std::assoc_laguerre;
>    using std::assoc_laguerref;
>    using std::assoc_laguerrel;
> --
> 2.34.1
>


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

* Re: [PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-02-20 11:30 ` Jonathan Wakely
@ 2023-02-20 11:57   ` Nathaniel Shead
  2023-02-20 12:08     ` Jonathan Wakely
  0 siblings, 1 reply; 12+ messages in thread
From: Nathaniel Shead @ 2023-02-20 11:57 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On Mon, Feb 20, 2023 at 10:30 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Mon, 20 Feb 2023 at 11:23, Nathaniel Shead via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > The comments on PR79700 mentioned that it was somewhat ambiguous whether
> > these functions were supposed to exist for C++11 or not. I chose to add
> > them there, since other resources (such as cppreference) seem to think
> > that C++11 should be the standard these functions were introduced, and I
> > don't know of any reason to do otherwise.
> >
> > Tested on x86_64-linux.
>
> Thanks for the patch, but this needs tests for the new declarations
> (which are tedious to write, which is the main reason I haven't
> already pushed my own very similar patch).
>

Ah OK, fair enough. Where should the tests go? The only tests I could
find for the existing (non -f/l) functions was just tests for their
existence in testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
which I just added the new functions to - I guess I'll add a new file
here and test that all the functions can be called and give the same
results as the relevant overloaded variants?

>
> >
> > -- 8< --
> >
> > This patch adds the -f and -l variants of the C89 <math.h> functions to
> > <cmath> under namespace std (so std::sqrtf, std::fabsl, etc.) for C++11
> > and up.
> >
> > libstdc++-v3/ChangeLog:
> >
> >         PR libstdc++/79700
> >         * include/c_global/cmath (acosf, acosl, asinf, asinl, atanf,
> >         atanl, atan2f, atan2l, ceilf, ceill, cosf, cosl, coshf, coshl,
> >         expf, expl, fabsf, fabsl, floorf, floorl, fmodf, fmodl, frexpf,
> >         frexpl, ldexpf, ldexpl, logf, logl, log10f, log10l, modff,
> >         modfl, powf, powl, sinf, sinl, sinhf, sinhl, sqrtf, sqrtl, tanf,
> >         tanl, tanhf, tanhl): Add aliases in namespace std.
> >         * testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
> >         Add checks for existence of above names.
> >
> > Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
> > ---
> >  libstdc++-v3/include/c_global/cmath           | 111 ++++++++++++++++++
> >  .../headers/cmath/functions_std_c++17.cc      |  45 +++++++
> >  2 files changed, 156 insertions(+)
> >
> > diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
> > index 568eb354c2d..eaebde33dee 100644
> > --- a/libstdc++-v3/include/c_global/cmath
> > +++ b/libstdc++-v3/include/c_global/cmath
> > @@ -1767,6 +1767,117 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >
> >  #if __cplusplus >= 201103L
> >
> > +#undef acosf
> > +#undef acosl
> > +#undef asinf
> > +#undef asinl
> > +#undef atanf
> > +#undef atanl
> > +#undef atan2f
> > +#undef atan2l
> > +#undef ceilf
> > +#undef ceill
> > +#undef cosf
> > +#undef cosl
> > +#undef coshf
> > +#undef coshl
> > +#undef expf
> > +#undef expl
> > +#undef fabsf
> > +#undef fabsl
> > +#undef floorf
> > +#undef floorl
> > +#undef fmodf
> > +#undef fmodl
> > +#undef frexpf
> > +#undef frexpl
> > +#undef ldexpf
> > +#undef ldexpl
> > +#undef logf
> > +#undef logl
> > +#undef log10f
> > +#undef log10l
> > +#undef modff
> > +#undef modfl
> > +#undef powf
> > +#undef powl
> > +#undef sinf
> > +#undef sinl
> > +#undef sinhf
> > +#undef sinhl
> > +#undef sqrtf
> > +#undef sqrtl
> > +#undef tanf
> > +#undef tanl
> > +#undef tanhf
> > +#undef tanhl
> > +
> > +  using ::acosf;
> > +  using ::acosl;
> > +
> > +  using ::asinf;
> > +  using ::asinl;
> > +
> > +  using ::atanf;
> > +  using ::atanl;
> > +
> > +  using ::atan2f;
> > +  using ::atan2l;
> > +
> > +  using ::ceilf;
> > +  using ::ceill;
> > +
> > +  using ::cosf;
> > +  using ::cosl;
> > +
> > +  using ::coshf;
> > +  using ::coshl;
> > +
> > +  using ::expf;
> > +  using ::expl;
> > +
> > +  using ::fabsf;
> > +  using ::fabsl;
> > +
> > +  using ::floorf;
> > +  using ::floorl;
> > +
> > +  using ::fmodf;
> > +  using ::fmodl;
> > +
> > +  using ::frexpf;
> > +  using ::frexpl;
> > +
> > +  using ::ldexpf;
> > +  using ::ldexpl;
> > +
> > +  using ::logf;
> > +  using ::logl;
> > +
> > +  using ::log10f;
> > +  using ::log10l;
> > +
> > +  using ::modff;
> > +  using ::modfl;
> > +
> > +  using ::powf;
> > +  using ::powl;
> > +
> > +  using ::sinf;
> > +  using ::sinl;
> > +
> > +  using ::sinhf;
> > +  using ::sinhl;
> > +
> > +  using ::sqrtf;
> > +  using ::sqrtl;
> > +
> > +  using ::tanf;
> > +  using ::tanl;
> > +
> > +  using ::tanhf;
> > +  using ::tanhl;
> > +
> >  #ifdef _GLIBCXX_USE_C99_MATH_TR1
> >
> >  #undef acosh
> > diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > index 3b4ada1a756..c6ec636c183 100644
> > --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > @@ -44,6 +44,51 @@ namespace gnu
> >    using std::tan;
> >    using std::tanh;
> >
> > +  using std::acosf;
> > +  using std::acosl;
> > +  using std::asinf;
> > +  using std::asinl;
> > +  using std::atanf;
> > +  using std::atanl;
> > +  using std::atan2f;
> > +  using std::atan2l;
> > +  using std::ceilf;
> > +  using std::ceill;
> > +  using std::cosf;
> > +  using std::cosl;
> > +  using std::coshf;
> > +  using std::coshl;
> > +  using std::expf;
> > +  using std::expl;
> > +  using std::fabsf;
> > +  using std::fabsl;
> > +  using std::floorf;
> > +  using std::floorl;
> > +  using std::fmodf;
> > +  using std::fmodl;
> > +  using std::frexpf;
> > +  using std::frexpl;
> > +  using std::ldexpf;
> > +  using std::ldexpl;
> > +  using std::logf;
> > +  using std::logl;
> > +  using std::log10f;
> > +  using std::log10l;
> > +  using std::modff;
> > +  using std::modfl;
> > +  using std::powf;
> > +  using std::powl;
> > +  using std::sinf;
> > +  using std::sinl;
> > +  using std::sinhf;
> > +  using std::sinhl;
> > +  using std::sqrtf;
> > +  using std::sqrtl;
> > +  using std::tanf;
> > +  using std::tanl;
> > +  using std::tanhf;
> > +  using std::tanhl;
> > +
> >    using std::assoc_laguerre;
> >    using std::assoc_laguerref;
> >    using std::assoc_laguerrel;
> > --
> > 2.34.1
> >
>

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

* Re: [PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-02-20 11:57   ` Nathaniel Shead
@ 2023-02-20 12:08     ` Jonathan Wakely
  2023-02-21 11:22       ` Nathaniel Shead
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Wakely @ 2023-02-20 12:08 UTC (permalink / raw)
  To: Nathaniel Shead; +Cc: libstdc++, gcc-patches

On Mon, 20 Feb 2023 at 11:57, Nathaniel Shead <nathanieloshead@gmail.com> wrote:
>
> On Mon, Feb 20, 2023 at 10:30 PM Jonathan Wakely <jwakely@redhat.com> wrote:
> >
> > On Mon, 20 Feb 2023 at 11:23, Nathaniel Shead via Libstdc++
> > <libstdc++@gcc.gnu.org> wrote:
> > >
> > > The comments on PR79700 mentioned that it was somewhat ambiguous whether
> > > these functions were supposed to exist for C++11 or not. I chose to add
> > > them there, since other resources (such as cppreference) seem to think
> > > that C++11 should be the standard these functions were introduced, and I
> > > don't know of any reason to do otherwise.
> > >
> > > Tested on x86_64-linux.
> >
> > Thanks for the patch, but this needs tests for the new declarations
> > (which are tedious to write, which is the main reason I haven't
> > already pushed my own very similar patch).
> >
>
> Ah OK, fair enough. Where should the tests go? The only tests I could
> find for the existing (non -f/l) functions was just tests for their
> existence in testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> which I just added the new functions to - I guess I'll add a new file
> here and test that all the functions can be called and give the same
> results as the relevant overloaded variants?

Yeah, that sounds great, thanks!


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

* Re: [PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-02-20 12:08     ` Jonathan Wakely
@ 2023-02-21 11:22       ` Nathaniel Shead
  2023-04-17  8:10         ` [Ping][PATCH] " Nathaniel Shead
  0 siblings, 1 reply; 12+ messages in thread
From: Nathaniel Shead @ 2023-02-21 11:22 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On Mon, Feb 20, 2023 at 12:08:38PM +0000, Jonathan Wakely wrote:
> On Mon, 20 Feb 2023 at 11:57, Nathaniel Shead <nathanieloshead@gmail.com> wrote:
> >
> > On Mon, Feb 20, 2023 at 10:30 PM Jonathan Wakely <jwakely@redhat.com> wrote:
> > >
> > > On Mon, 20 Feb 2023 at 11:23, Nathaniel Shead via Libstdc++
> > > <libstdc++@gcc.gnu.org> wrote:
> > > >
> > > > The comments on PR79700 mentioned that it was somewhat ambiguous whether
> > > > these functions were supposed to exist for C++11 or not. I chose to add
> > > > them there, since other resources (such as cppreference) seem to think
> > > > that C++11 should be the standard these functions were introduced, and I
> > > > don't know of any reason to do otherwise.
> > > >
> > > > Tested on x86_64-linux.
> > >
> > > Thanks for the patch, but this needs tests for the new declarations
> > > (which are tedious to write, which is the main reason I haven't
> > > already pushed my own very similar patch).
> > >
> >
> > Ah OK, fair enough. Where should the tests go? The only tests I could
> > find for the existing (non -f/l) functions was just tests for their
> > existence in testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
> > which I just added the new functions to - I guess I'll add a new file
> > here and test that all the functions can be called and give the same
> > results as the relevant overloaded variants?
> 
> Yeah, that sounds great, thanks!
> 

How does this look?

-- 8< --

This patch adds the -f and -l variants of the C89 <math.h> functions to
<cmath> under namespace std (so std::sqrtf, std::fabsl, etc.) for C++11
and up.

libstdc++-v3/ChangeLog:

	PR libstdc++/79700
	* include/c_global/cmath (acosf, acosl, asinf, asinl, atanf,
        atanl, atan2f, atan2l, ceilf, ceill, cosf, cosl, coshf, coshl,
        expf, expl, fabsf, fabsl, floorf, floorl, fmodf, fmodl, frexpf,
        frexpl, ldexpf, ldexpl, logf, logl, log10f, log10l, modff,
        modfl, powf, powl, sinf, sinl, sinhf, sinhl, sqrtf, sqrtl, tanf,
        tanl, tanhf, tanhl): Add aliases in namespace std.
        * testsuite/26_numerics/headers/cmath/equivalent_functions.cc:
        New test.
	* testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
        Add checks for existence of above names.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
---
 libstdc++-v3/include/c_global/cmath           | 111 +++++++++
 .../headers/cmath/equivalent_functions.cc     | 224 ++++++++++++++++++
 .../headers/cmath/functions_std_c++17.cc      |  45 ++++
 3 files changed, 380 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/equivalent_functions.cc

diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 568eb354c2d..eaebde33dee 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -1767,6 +1767,117 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus >= 201103L
 
+#undef acosf
+#undef acosl
+#undef asinf
+#undef asinl
+#undef atanf
+#undef atanl
+#undef atan2f
+#undef atan2l
+#undef ceilf
+#undef ceill
+#undef cosf
+#undef cosl
+#undef coshf
+#undef coshl
+#undef expf
+#undef expl
+#undef fabsf
+#undef fabsl
+#undef floorf
+#undef floorl
+#undef fmodf
+#undef fmodl
+#undef frexpf
+#undef frexpl
+#undef ldexpf
+#undef ldexpl
+#undef logf
+#undef logl
+#undef log10f
+#undef log10l
+#undef modff
+#undef modfl
+#undef powf
+#undef powl
+#undef sinf
+#undef sinl
+#undef sinhf
+#undef sinhl
+#undef sqrtf
+#undef sqrtl
+#undef tanf
+#undef tanl
+#undef tanhf
+#undef tanhl
+
+  using ::acosf;
+  using ::acosl;
+
+  using ::asinf;
+  using ::asinl;
+
+  using ::atanf;
+  using ::atanl;
+
+  using ::atan2f;
+  using ::atan2l;
+
+  using ::ceilf;
+  using ::ceill;
+
+  using ::cosf;
+  using ::cosl;
+
+  using ::coshf;
+  using ::coshl;
+
+  using ::expf;
+  using ::expl;
+
+  using ::fabsf;
+  using ::fabsl;
+
+  using ::floorf;
+  using ::floorl;
+
+  using ::fmodf;
+  using ::fmodl;
+
+  using ::frexpf;
+  using ::frexpl;
+
+  using ::ldexpf;
+  using ::ldexpl;
+
+  using ::logf;
+  using ::logl;
+
+  using ::log10f;
+  using ::log10l;
+
+  using ::modff;
+  using ::modfl;
+
+  using ::powf;
+  using ::powl;
+
+  using ::sinf;
+  using ::sinl;
+
+  using ::sinhf;
+  using ::sinhl;
+
+  using ::sqrtf;
+  using ::sqrtl;
+
+  using ::tanf;
+  using ::tanl;
+
+  using ::tanhf;
+  using ::tanhl;
+
 #ifdef _GLIBCXX_USE_C99_MATH_TR1
 
 #undef acosh
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/equivalent_functions.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/equivalent_functions.cc
new file mode 100644
index 00000000000..8639279e8a1
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/equivalent_functions.cc
@@ -0,0 +1,224 @@
+// Copyright (C) 2023 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+#include <testsuite_hooks.h>
+
+#include <type_traits>
+#include <cmath>
+// also include functions in global namespace
+#include <math.h>
+
+static_assert(std::is_same<decltype(std::acosf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::asinf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::atanf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::atan2f(0.0, 0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::ceilf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::cosf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::coshf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::expf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::fabsf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::floorf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::fmodf(0.0, 0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::frexpf(0.0, nullptr)), float>::value, "");
+static_assert(std::is_same<decltype(std::ldexpf(0.0, 0)), float>::value, "");
+static_assert(std::is_same<decltype(std::logf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::log10f(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::modff(0.0, nullptr)), float>::value, "");
+static_assert(std::is_same<decltype(std::powf(0.0, 0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::sinf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::sinhf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::sqrtf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::tanf(0.0)), float>::value, "");
+static_assert(std::is_same<decltype(std::tanhf(0.0)), float>::value, "");
+
+static_assert(std::is_same<decltype(std::acosl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::asinl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::atanl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::atan2l(0.0, 0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::ceill(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::cosl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::coshl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::expl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::fabsl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::floorl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::fmodl(0.0, 0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::frexpl(0.0, nullptr)), long double>::value, "");
+static_assert(std::is_same<decltype(std::ldexpl(0.0, 0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::logl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::log10l(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::modfl(0.0, nullptr)), long double>::value, "");
+static_assert(std::is_same<decltype(std::powl(0.0, 0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::sinl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::sinhl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::sqrtl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::tanl(0.0)), long double>::value, "");
+static_assert(std::is_same<decltype(std::tanhl(0.0)), long double>::value, "");
+
+void
+test_float_global()
+{
+  float x = 1.0f;
+
+  int e1 = 0;
+  int e2 = 0;
+  float i1 = 0.0f;
+  float i2 = 0.0f;
+
+  VERIFY(::acosf(x) == std::acosf(x));
+  VERIFY(::asinf(x) == std::asinf(x));
+  VERIFY(::atanf(x) == std::atanf(x));
+  VERIFY(::atan2f(x, x) == std::atan2f(x, x));
+  VERIFY(::ceilf(x) == std::ceilf(x));
+  VERIFY(::cosf(x) == std::cosf(x));
+  VERIFY(::coshf(x) == std::coshf(x));
+  VERIFY(::expf(x) == std::expf(x));
+  VERIFY(::fabsf(x) == std::fabsf(x));
+  VERIFY(::floorf(x) == std::floorf(x));
+  VERIFY(::fmodf(x, x) == std::fmodf(x, x));
+  VERIFY(::frexpf(x, &e1) == std::frexpf(x, &e2));
+  VERIFY(e1 == e2);
+  VERIFY(::ldexpf(x, 1) == std::ldexpf(x, 1));
+  VERIFY(::logf(x) == std::logf(x));
+  VERIFY(::log10f(x) == std::log10f(x));
+  VERIFY(::modff(x, &i1) == std::modff(x, &i2));
+  VERIFY(i1 == i2);
+  VERIFY(::powf(x, x) == std::powf(x, x));
+  VERIFY(::sinf(x) == std::sinf(x));
+  VERIFY(::sinhf(x) == std::sinhf(x));
+  VERIFY(::sqrtf(x) == std::sqrtf(x));
+  VERIFY(::tanf(x) == std::tanf(x));
+  VERIFY(::tanhf(x) == std::tanhf(x));
+}
+
+void
+test_float_overload()
+{
+  float x = 1.0f;
+
+  int e1 = 0;
+  int e2 = 0;
+  float i1 = 0.0f;
+  float i2 = 0.0f;
+
+  VERIFY(std::acos(x) == std::acosf(x));
+  VERIFY(std::asin(x) == std::asinf(x));
+  VERIFY(std::atan(x) == std::atanf(x));
+  VERIFY(std::atan2(x, x) == std::atan2f(x, x));
+  VERIFY(std::ceil(x) == std::ceilf(x));
+  VERIFY(std::cos(x) == std::cosf(x));
+  VERIFY(std::cosh(x) == std::coshf(x));
+  VERIFY(std::exp(x) == std::expf(x));
+  VERIFY(std::fabs(x) == std::fabsf(x));
+  VERIFY(std::floor(x) == std::floorf(x));
+  VERIFY(std::fmod(x, x) == std::fmodf(x, x));
+  VERIFY(std::frexp(x, &e1) == std::frexpf(x, &e2));
+  VERIFY(e1 == e2);
+  VERIFY(std::ldexp(x, 1) == std::ldexpf(x, 1));
+  VERIFY(std::log(x) == std::logf(x));
+  VERIFY(std::log10(x) == std::log10f(x));
+  VERIFY(std::modf(x, &i1) == std::modff(x, &i2));
+  VERIFY(i1 == i2);
+  VERIFY(std::pow(x, x) == std::powf(x, x));
+  VERIFY(std::sin(x) == std::sinf(x));
+  VERIFY(std::sinh(x) == std::sinhf(x));
+  VERIFY(std::sqrt(x) == std::sqrtf(x));
+  VERIFY(std::tan(x) == std::tanf(x));
+  VERIFY(std::tanh(x) == std::tanhf(x));
+}
+
+void
+test_long_double_global()
+{
+  long double x = 1.0L;
+
+  int e1 = 0;
+  int e2 = 0;
+  long double i1 = 0.0L;
+  long double i2 = 0.0L;
+
+  VERIFY(::acosl(x) == std::acosl(x));
+  VERIFY(::asinl(x) == std::asinl(x));
+  VERIFY(::atanl(x) == std::atanl(x));
+  VERIFY(::atan2l(x, x) == std::atan2l(x, x));
+  VERIFY(::ceill(x) == std::ceill(x));
+  VERIFY(::cosl(x) == std::cosl(x));
+  VERIFY(::coshl(x) == std::coshl(x));
+  VERIFY(::expl(x) == std::expl(x));
+  VERIFY(::fabsl(x) == std::fabsl(x));
+  VERIFY(::floorl(x) == std::floorl(x));
+  VERIFY(::fmodl(x, x) == std::fmodl(x, x));
+  VERIFY(::frexpl(x, &e1) == std::frexpl(x, &e2));
+  VERIFY(e1 == e2);
+  VERIFY(::ldexpl(x, 1) == std::ldexpl(x, 1));
+  VERIFY(::logl(x) == std::logl(x));
+  VERIFY(::log10l(x) == std::log10l(x));
+  VERIFY(::modfl(x, &i1) == std::modfl(x, &i2));
+  VERIFY(i1 == i2);
+  VERIFY(::powl(x, x) == std::powl(x, x));
+  VERIFY(::sinl(x) == std::sinl(x));
+  VERIFY(::sinhl(x) == std::sinhl(x));
+  VERIFY(::sqrtl(x) == std::sqrtl(x));
+  VERIFY(::tanl(x) == std::tanl(x));
+  VERIFY(::tanhl(x) == std::tanhl(x));
+}
+
+void
+test_long_double_overload()
+{
+  long double x = 1.0L;
+
+  int e1 = 0;
+  int e2 = 0;
+  long double i1 = 0.0L;
+  long double i2 = 0.0L;
+
+  VERIFY(std::acos(x) == std::acosl(x));
+  VERIFY(std::asin(x) == std::asinl(x));
+  VERIFY(std::atan(x) == std::atanl(x));
+  VERIFY(std::atan2(x, x) == std::atan2l(x, x));
+  VERIFY(std::ceil(x) == std::ceill(x));
+  VERIFY(std::cos(x) == std::cosl(x));
+  VERIFY(std::cosh(x) == std::coshl(x));
+  VERIFY(std::exp(x) == std::expl(x));
+  VERIFY(std::fabs(x) == std::fabsl(x));
+  VERIFY(std::floor(x) == std::floorl(x));
+  VERIFY(std::fmod(x, x) == std::fmodl(x, x));
+  VERIFY(std::frexp(x, &e1) == std::frexpl(x, &e2));
+  VERIFY(e1 == e2);
+  VERIFY(std::ldexp(x, 1) == std::ldexpl(x, 1));
+  VERIFY(std::log(x) == std::logl(x));
+  VERIFY(std::log10(x) == std::log10l(x));
+  VERIFY(std::modf(x, &i1) == std::modfl(x, &i2));
+  VERIFY(i1 == i2);
+  VERIFY(std::pow(x, x) == std::powl(x, x));
+  VERIFY(std::sin(x) == std::sinl(x));
+  VERIFY(std::sinh(x) == std::sinhl(x));
+  VERIFY(std::sqrt(x) == std::sqrtl(x));
+  VERIFY(std::tan(x) == std::tanl(x));
+  VERIFY(std::tanh(x) == std::tanhl(x));
+}
+
+int
+main ()
+{
+  test_float_global();
+  test_float_overload();
+  test_long_double_global();
+  test_long_double_overload();
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
index 3b4ada1a756..c6ec636c183 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc
@@ -44,6 +44,51 @@ namespace gnu
   using std::tan;
   using std::tanh;
 
+  using std::acosf;
+  using std::acosl;
+  using std::asinf;
+  using std::asinl;
+  using std::atanf;
+  using std::atanl;
+  using std::atan2f;
+  using std::atan2l;
+  using std::ceilf;
+  using std::ceill;
+  using std::cosf;
+  using std::cosl;
+  using std::coshf;
+  using std::coshl;
+  using std::expf;
+  using std::expl;
+  using std::fabsf;
+  using std::fabsl;
+  using std::floorf;
+  using std::floorl;
+  using std::fmodf;
+  using std::fmodl;
+  using std::frexpf;
+  using std::frexpl;
+  using std::ldexpf;
+  using std::ldexpl;
+  using std::logf;
+  using std::logl;
+  using std::log10f;
+  using std::log10l;
+  using std::modff;
+  using std::modfl;
+  using std::powf;
+  using std::powl;
+  using std::sinf;
+  using std::sinl;
+  using std::sinhf;
+  using std::sinhl;
+  using std::sqrtf;
+  using std::sqrtl;
+  using std::tanf;
+  using std::tanl;
+  using std::tanhf;
+  using std::tanhl;
+
   using std::assoc_laguerre;
   using std::assoc_laguerref;
   using std::assoc_laguerrel;
-- 
2.34.1


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

* [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-02-21 11:22       ` Nathaniel Shead
@ 2023-04-17  8:10         ` Nathaniel Shead
  2023-04-18  8:47           ` Jonathan Wakely
  0 siblings, 1 reply; 12+ messages in thread
From: Nathaniel Shead @ 2023-04-17  8:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

Hi, just checking whether there were any issues with this patch?
https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html

Otherwise I assume it won't be in GCC13.

Thanks,
Nathaniel

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

* Re: [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-04-17  8:10         ` [Ping][PATCH] " Nathaniel Shead
@ 2023-04-18  8:47           ` Jonathan Wakely
  2023-05-17  8:37             ` Nathaniel Shead
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Wakely @ 2023-04-18  8:47 UTC (permalink / raw)
  To: Nathaniel Shead; +Cc: libstdc++, gcc-patches

On Mon, 17 Apr 2023 at 09:11, Nathaniel Shead <nathanieloshead@gmail.com> wrote:
>
> Hi, just checking whether there were any issues with this patch?
> https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html
>
> Otherwise I assume it won't be in GCC13.

That's right, it's too large and invasive a change to get into GCC 13
when only submitted in February, sorry. I'll merge it to trunk once
GCC 13.1 is released though.


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

* Re: [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-04-18  8:47           ` Jonathan Wakely
@ 2023-05-17  8:37             ` Nathaniel Shead
  2023-05-17  9:05               ` Jonathan Wakely
  0 siblings, 1 reply; 12+ messages in thread
From: Nathaniel Shead @ 2023-05-17  8:37 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

Now that GCC13.1 is released is it ok to merge? Thanks!

On Tue, Apr 18, 2023 at 6:48 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Mon, 17 Apr 2023 at 09:11, Nathaniel Shead <nathanieloshead@gmail.com> wrote:
> >
> > Hi, just checking whether there were any issues with this patch?
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html
> >
> > Otherwise I assume it won't be in GCC13.
>
> That's right, it's too large and invasive a change to get into GCC 13
> when only submitted in February, sorry. I'll merge it to trunk once
> GCC 13.1 is released though.
>

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

* Re: [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-05-17  8:37             ` Nathaniel Shead
@ 2023-05-17  9:05               ` Jonathan Wakely
  2023-05-17  9:38                 ` Nathaniel Shead
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Wakely @ 2023-05-17  9:05 UTC (permalink / raw)
  To: Nathaniel Shead; +Cc: libstdc++, gcc-patches

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

On Wed, 17 May 2023 at 09:37, Nathaniel Shead wrote:

> Now that GCC13.1 is released is it ok to merge? Thanks!
>

Yes, I've been testing this locally, but I think it needs more work (sorry!)

Looking at it again, I'm not sure why I asked for the additional tests
because if they fail, it's a problem in libc, and there's nothing we can
actually do about it in libstdc++. We certainly do want std::expl(0.0L) to
return the same thing as std::exp(0.0L), but if it doesn't, we'll just have
a libstdc++ test failure caused by a bug in libc. But you wrote the test
now, so let's keep it. If we get failures for the test it will allow us to
inform the relevant libc maintainers that they have a bug.

Also, since you're contributing this under the DCO terms the new test
should not have the FSF copyright header, unless it's a derived work of an
existing test with that header (and in that case it should retain the dates
from the copied test). I don't actually bother putting the copyright and
license header on new tests these days. There's nothing in that test that
is novel or interesting, and I think it's arguably not useful or meaningful
to consider it copyrighted.

Finally, and most importantly, the new using-declarations in <cmath> are
not guarded by any autoconf macro. That will break targets without full C99
<math.h> support, e.g. djgpp declares acosf but not acosl, so the new
"using acosl;" would be a hard error as soon as <cmath> is included (and
might even prevent GCC building on that target). So I think we need a new
autoconf check for the existence of those functions. I'm in the process of
reworking the autoconf macros for <cmath> (due to PR 109818), which is why
I didn't address it for this patch yet.



>
> On Tue, Apr 18, 2023 at 6:48 PM Jonathan Wakely <jwakely@redhat.com>
> wrote:
> >
> > On Mon, 17 Apr 2023 at 09:11, Nathaniel Shead <nathanieloshead@gmail.com>
> wrote:
> > >
> > > Hi, just checking whether there were any issues with this patch?
> > > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html
> > >
> > > Otherwise I assume it won't be in GCC13.
> >
> > That's right, it's too large and invasive a change to get into GCC 13
> > when only submitted in February, sorry. I'll merge it to trunk once
> > GCC 13.1 is released though.
> >
>
>

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

* Re: [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-05-17  9:05               ` Jonathan Wakely
@ 2023-05-17  9:38                 ` Nathaniel Shead
  2023-05-17 10:07                   ` Jonathan Wakely
  0 siblings, 1 reply; 12+ messages in thread
From: Nathaniel Shead @ 2023-05-17  9:38 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On Wed, May 17, 2023 at 10:05:59AM +0100, Jonathan Wakely wrote:
> On Wed, 17 May 2023 at 09:37, Nathaniel Shead wrote:
> 
> > Now that GCC13.1 is released is it ok to merge? Thanks!
> >
> 
> Yes, I've been testing this locally, but I think it needs more work (sorry!)
> 
> Looking at it again, I'm not sure why I asked for the additional tests
> because if they fail, it's a problem in libc, and there's nothing we can
> actually do about it in libstdc++. We certainly do want std::expl(0.0L) to
> return the same thing as std::exp(0.0L), but if it doesn't, we'll just have
> a libstdc++ test failure caused by a bug in libc. But you wrote the test
> now, so let's keep it. If we get failures for the test it will allow us to
> inform the relevant libc maintainers that they have a bug.

Sounds good.

> Also, since you're contributing this under the DCO terms the new test
> should not have the FSF copyright header, unless it's a derived work of an
> existing test with that header (and in that case it should retain the dates
> from the copied test). I don't actually bother putting the copyright and
> license header on new tests these days. There's nothing in that test that
> is novel or interesting, and I think it's arguably not useful or meaningful
> to consider it copyrighted.

Makes sense, I was just copying from other tests in the directory. I'll
keep this in mind for the future, thanks!

> Finally, and most importantly, the new using-declarations in <cmath> are
> not guarded by any autoconf macro. That will break targets without full C99
> <math.h> support, e.g. djgpp declares acosf but not acosl, so the new
> "using acosl;" would be a hard error as soon as <cmath> is included (and
> might even prevent GCC building on that target). So I think we need a new
> autoconf check for the existence of those functions. I'm in the process of
> reworking the autoconf macros for <cmath> (due to PR 109818), which is why
> I didn't address it for this patch yet.

Ah, I see; yes, that would be a problem. I'm not very familiar with
autoconf, so thanks for working this out. Let me know when you've done
that if there's anything else I should do for this patch.

> >
> > On Tue, Apr 18, 2023 at 6:48 PM Jonathan Wakely <jwakely@redhat.com>
> > wrote:
> > >
> > > On Mon, 17 Apr 2023 at 09:11, Nathaniel Shead <nathanieloshead@gmail.com>
> > wrote:
> > > >
> > > > Hi, just checking whether there were any issues with this patch?
> > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html
> > > >
> > > > Otherwise I assume it won't be in GCC13.
> > >
> > > That's right, it's too large and invasive a change to get into GCC 13
> > > when only submitted in February, sorry. I'll merge it to trunk once
> > > GCC 13.1 is released though.
> > >
> >
> >

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

* Re: [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-05-17  9:38                 ` Nathaniel Shead
@ 2023-05-17 10:07                   ` Jonathan Wakely
  2023-11-11  0:43                     ` Jonathan Wakely
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Wakely @ 2023-05-17 10:07 UTC (permalink / raw)
  To: Nathaniel Shead; +Cc: libstdc++, gcc-patches

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

On Wed, 17 May 2023 at 10:38, Nathaniel Shead <nathanieloshead@gmail.com>
wrote:

> On Wed, May 17, 2023 at 10:05:59AM +0100, Jonathan Wakely wrote:
> > On Wed, 17 May 2023 at 09:37, Nathaniel Shead wrote:
> >
> > > Now that GCC13.1 is released is it ok to merge? Thanks!
> > >
> >
> > Yes, I've been testing this locally, but I think it needs more work
> (sorry!)
> >
> > Looking at it again, I'm not sure why I asked for the additional tests
> > because if they fail, it's a problem in libc, and there's nothing we can
> > actually do about it in libstdc++. We certainly do want std::expl(0.0L)
> to
> > return the same thing as std::exp(0.0L), but if it doesn't, we'll just
> have
> > a libstdc++ test failure caused by a bug in libc. But you wrote the test
> > now, so let's keep it. If we get failures for the test it will allow us
> to
> > inform the relevant libc maintainers that they have a bug.
>
> Sounds good.
>
> > Also, since you're contributing this under the DCO terms the new test
> > should not have the FSF copyright header, unless it's a derived work of
> an
> > existing test with that header (and in that case it should retain the
> dates
> > from the copied test). I don't actually bother putting the copyright and
> > license header on new tests these days. There's nothing in that test that
> > is novel or interesting, and I think it's arguably not useful or
> meaningful
> > to consider it copyrighted.
>
> Makes sense, I was just copying from other tests in the directory. I'll
> keep this in mind for the future, thanks!
>

Yeah, we have a mix of tests using the old conventions (with copyright and
GPL headers) and new conventions (don't bother, they're not really
meaningful on tests).

We're unlikely to *remove* the copyright notices from the old tests,
because that would require all sorts of legal wrangling, and it's not clear
that the copyright holder (the FSF) would agree to it anyway.





> > Finally, and most importantly, the new using-declarations in <cmath> are
> > not guarded by any autoconf macro. That will break targets without full
> C99
> > <math.h> support, e.g. djgpp declares acosf but not acosl, so the new
> > "using acosl;" would be a hard error as soon as <cmath> is included (and
> > might even prevent GCC building on that target). So I think we need a new
> > autoconf check for the existence of those functions. I'm in the process
> of
> > reworking the autoconf macros for <cmath> (due to PR 109818), which is
> why
> > I didn't address it for this patch yet.
>
> Ah, I see; yes, that would be a problem. I'm not very familiar with
> autoconf, so thanks for working this out. Let me know when you've done
> that if there's anything else I should do for this patch.
>

I hope to have an updated patch by next week, so I'll let you know once
that's ready. Thanks for your patience and for pining the patch.



> > >
> > > On Tue, Apr 18, 2023 at 6:48 PM Jonathan Wakely <jwakely@redhat.com>
> > > wrote:
> > > >
> > > > On Mon, 17 Apr 2023 at 09:11, Nathaniel Shead <
> nathanieloshead@gmail.com>
> > > wrote:
> > > > >
> > > > > Hi, just checking whether there were any issues with this patch?
> > > > >
> https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html
> > > > >
> > > > > Otherwise I assume it won't be in GCC13.
> > > >
> > > > That's right, it's too large and invasive a change to get into GCC 13
> > > > when only submitted in February, sorry. I'll merge it to trunk once
> > > > GCC 13.1 is released though.
> > > >
> > >
> > >
>
>

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

* Re: [Ping][PATCH] libstdc++: Add missing functions to <cmath> [PR79700]
  2023-05-17 10:07                   ` Jonathan Wakely
@ 2023-11-11  0:43                     ` Jonathan Wakely
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Wakely @ 2023-11-11  0:43 UTC (permalink / raw)
  To: Nathaniel Shead; +Cc: libstdc++, gcc-patches

I've finally convinced myself that this patch is OK, because we
provide stub versions of all the functions being declared here. So if
a target is missing them, we provide them anyway. That happens to be
broken for the avr target, but that defaults to --disable-libstdcxx
anyway.

I've pushed the patch to trunk - thanks for the work on it!



On Wed, 17 May 2023 at 11:07, Jonathan Wakely <jwakely@redhat.com> wrote:
>
>
>
> On Wed, 17 May 2023 at 10:38, Nathaniel Shead <nathanieloshead@gmail.com> wrote:
>>
>> On Wed, May 17, 2023 at 10:05:59AM +0100, Jonathan Wakely wrote:
>> > On Wed, 17 May 2023 at 09:37, Nathaniel Shead wrote:
>> >
>> > > Now that GCC13.1 is released is it ok to merge? Thanks!
>> > >
>> >
>> > Yes, I've been testing this locally, but I think it needs more work (sorry!)
>> >
>> > Looking at it again, I'm not sure why I asked for the additional tests
>> > because if they fail, it's a problem in libc, and there's nothing we can
>> > actually do about it in libstdc++. We certainly do want std::expl(0.0L) to
>> > return the same thing as std::exp(0.0L), but if it doesn't, we'll just have
>> > a libstdc++ test failure caused by a bug in libc. But you wrote the test
>> > now, so let's keep it. If we get failures for the test it will allow us to
>> > inform the relevant libc maintainers that they have a bug.
>>
>> Sounds good.
>>
>> > Also, since you're contributing this under the DCO terms the new test
>> > should not have the FSF copyright header, unless it's a derived work of an
>> > existing test with that header (and in that case it should retain the dates
>> > from the copied test). I don't actually bother putting the copyright and
>> > license header on new tests these days. There's nothing in that test that
>> > is novel or interesting, and I think it's arguably not useful or meaningful
>> > to consider it copyrighted.
>>
>> Makes sense, I was just copying from other tests in the directory. I'll
>> keep this in mind for the future, thanks!
>
>
> Yeah, we have a mix of tests using the old conventions (with copyright and GPL headers) and new conventions (don't bother, they're not really meaningful on tests).
>
> We're unlikely to *remove* the copyright notices from the old tests, because that would require all sorts of legal wrangling, and it's not clear that the copyright holder (the FSF) would agree to it anyway.
>
>
>
>
>>
>> > Finally, and most importantly, the new using-declarations in <cmath> are
>> > not guarded by any autoconf macro. That will break targets without full C99
>> > <math.h> support, e.g. djgpp declares acosf but not acosl, so the new
>> > "using acosl;" would be a hard error as soon as <cmath> is included (and
>> > might even prevent GCC building on that target). So I think we need a new
>> > autoconf check for the existence of those functions. I'm in the process of
>> > reworking the autoconf macros for <cmath> (due to PR 109818), which is why
>> > I didn't address it for this patch yet.
>>
>> Ah, I see; yes, that would be a problem. I'm not very familiar with
>> autoconf, so thanks for working this out. Let me know when you've done
>> that if there's anything else I should do for this patch.
>
>
> I hope to have an updated patch by next week, so I'll let you know once that's ready. Thanks for your patience and for pining the patch.
>
>
>>
>> > >
>> > > On Tue, Apr 18, 2023 at 6:48 PM Jonathan Wakely <jwakely@redhat.com>
>> > > wrote:
>> > > >
>> > > > On Mon, 17 Apr 2023 at 09:11, Nathaniel Shead <nathanieloshead@gmail.com>
>> > > wrote:
>> > > > >
>> > > > > Hi, just checking whether there were any issues with this patch?
>> > > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612386.html
>> > > > >
>> > > > > Otherwise I assume it won't be in GCC13.
>> > > >
>> > > > That's right, it's too large and invasive a change to get into GCC 13
>> > > > when only submitted in February, sorry. I'll merge it to trunk once
>> > > > GCC 13.1 is released though.
>> > > >
>> > >
>> > >
>>


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

end of thread, other threads:[~2023-11-11  0:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 11:23 [PATCH] libstdc++: Add missing functions to <cmath> [PR79700] Nathaniel Shead
2023-02-20 11:30 ` Jonathan Wakely
2023-02-20 11:57   ` Nathaniel Shead
2023-02-20 12:08     ` Jonathan Wakely
2023-02-21 11:22       ` Nathaniel Shead
2023-04-17  8:10         ` [Ping][PATCH] " Nathaniel Shead
2023-04-18  8:47           ` Jonathan Wakely
2023-05-17  8:37             ` Nathaniel Shead
2023-05-17  9:05               ` Jonathan Wakely
2023-05-17  9:38                 ` Nathaniel Shead
2023-05-17 10:07                   ` Jonathan Wakely
2023-11-11  0:43                     ` 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).