[PR105324] libstdc++: testsuite: pr105324 requires FP from_char

Message ID ory1zjfa60.fsf@lxoliva.fsfla.org
State Committed
Headers
Series [PR105324] libstdc++: testsuite: pr105324 requires FP from_char |

Commit Message

Alexandre Oliva May 3, 2022, 5:38 a.m. UTC
  The floating-point overloads of from_char are only declared if
_GLIBCXX_HAVE_USELOCALE is #defined as nonzero.  That's exposed from
charconv as _cpp_lib_to_chars >= 201611L, so guard the test body with
that.

Regstrapped on ppc64le-linux-gnu, and tested on
x86_64-linux-gnu-x-ppc{,64}-vx7r2 (without _GLIBCXX_HAVE_USELOCALE).
Ok to install?  gcc-12?  gcc-11?


for  libstdc++-v3/ChangeLog

	PR c++/105324
	* testsuite/20_util/from_chars/pr105324.cc: Guard test body
	with conditional for floating-point overloads of from_char.
---
 .../testsuite/20_util/from_chars/pr105324.cc       |    2 ++
 1 file changed, 2 insertions(+)
  

Comments

Jonathan Wakely May 3, 2022, 7:10 a.m. UTC | #1
On Tue, 3 May 2022, 06:39 Alexandre Oliva via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

>
> The floating-point overloads of from_char are only declared if
> _GLIBCXX_HAVE_USELOCALE is #defined as nonzero.  That's exposed from
> charconv as _cpp_lib_to_chars >= 201611L, so guard the test body with
> that.
>
> Regstrapped on ppc64le-linux-gnu, and tested on
> x86_64-linux-gnu-x-ppc{,64}-vx7r2 (without _GLIBCXX_HAVE_USELOCALE).
> Ok to install?  gcc-12?  gcc-11?
>
>
> for  libstdc++-v3/ChangeLog
>
>         PR c++/105324
>         * testsuite/20_util/from_chars/pr105324.cc: Guard test body
>         with conditional for floating-point overloads of from_char.
> ---
>  .../testsuite/20_util/from_chars/pr105324.cc       |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> index cecb17e41cc68..a9e08303ef49d 100644
> --- a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> +++ b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> @@ -5,10 +5,12 @@
>
>  int main()
>  {
> +#if _cpp_lib_to_chars >= 201611L // FP from_char not available otherwise.
>

That macro should start with two underscores.

OK for trunk and gcc-11 with that change.

gcc-12 branch needs RM approval. OK for 12.2 if not approved for 12.1

   // PR libstdc++/105324
>    // std::from_chars() assertion at floating_from_chars.cc:78
>    std::string s(512, '1');
>    s[1] = '.';
>    long double d;
>    std::from_chars(s.data(), s.data() + s.size(), d);
> +#endif
>  }
>
  
Alexandre Oliva May 3, 2022, 5:25 p.m. UTC | #2
On May  3, 2022, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:

> That macro should start with two underscores.

Doh!  Wow, eagle eyes!  :-)  Good catch, thanks!

Here's the corrected patch I'm installing, trunk for now, 12 and 11 once
it's allowed in 12.

> OK for trunk and gcc-11 with that change.

> gcc-12 branch needs RM approval. OK for 12.2 if not approved for 12.1


[PR105324] libstdc++: testsuite: pr105324 requires FP from_char

From: Alexandre Oliva <oliva@adacore.com>

The floating-point overloads of from_char are only declared if
_GLIBCXX_HAVE_USELOCALE is #defined as nonzero.  That's exposed from
charconv as __cpp_lib_to_chars >= 201611L, so guard the test body with
that.


for  libstdc++-v3/ChangeLog

	PR c++/105324
	* testsuite/20_util/from_chars/pr105324.cc: Guard test body
	with conditional for floating-point overloads of from_char.
---
 .../testsuite/20_util/from_chars/pr105324.cc       |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
index cecb17e41cc68..ef24b4c5c7b71 100644
--- a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
+++ b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
@@ -5,10 +5,12 @@
 
 int main()
 {
+#if __cpp_lib_to_chars >= 201611L // FP from_char not available otherwise.
   // PR libstdc++/105324
   // std::from_chars() assertion at floating_from_chars.cc:78
   std::string s(512, '1');
   s[1] = '.';
   long double d;
   std::from_chars(s.data(), s.data() + s.size(), d);
+#endif
 }
  
Jonathan Wakely May 3, 2022, 5:42 p.m. UTC | #3
On Tue, 3 May 2022, 18:26 Alexandre Oliva, <oliva@adacore.com> wrote:

> On May  3, 2022, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> > That macro should start with two underscores.
>
> Doh!  Wow, eagle eyes!  :-)  Good catch, thanks!
>
> Here's the corrected patch I'm installing, trunk for now, 12 and 11 once
> it's allowed in 12.
>

Great, thanks.


> > OK for trunk and gcc-11 with that change.
>
> > gcc-12 branch needs RM approval. OK for 12.2 if not approved for 12.1
>
>
> [PR105324] libstdc++: testsuite: pr105324 requires FP from_char
>
> From: Alexandre Oliva <oliva@adacore.com>
>
> The floating-point overloads of from_char are only declared if
> _GLIBCXX_HAVE_USELOCALE is #defined as nonzero.  That's exposed from
> charconv as __cpp_lib_to_chars >= 201611L, so guard the test body with
> that.
>
>
> for  libstdc++-v3/ChangeLog
>
>         PR c++/105324
>         * testsuite/20_util/from_chars/pr105324.cc: Guard test body
>         with conditional for floating-point overloads of from_char.
> ---
>  .../testsuite/20_util/from_chars/pr105324.cc       |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> index cecb17e41cc68..ef24b4c5c7b71 100644
> --- a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> +++ b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
> @@ -5,10 +5,12 @@
>
>  int main()
>  {
> +#if __cpp_lib_to_chars >= 201611L // FP from_char not available otherwise.
>    // PR libstdc++/105324
>    // std::from_chars() assertion at floating_from_chars.cc:78
>    std::string s(512, '1');
>    s[1] = '.';
>    long double d;
>    std::from_chars(s.data(), s.data() + s.size(), d);
> +#endif
>  }
>
>
> --
> Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
>    Free Software Activist                       GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts.  Ask me about <https://stallmansupport.org>
>
  

Patch

diff --git a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
index cecb17e41cc68..a9e08303ef49d 100644
--- a/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
+++ b/libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc
@@ -5,10 +5,12 @@ 
 
 int main()
 {
+#if _cpp_lib_to_chars >= 201611L // FP from_char not available otherwise.
   // PR libstdc++/105324
   // std::from_chars() assertion at floating_from_chars.cc:78
   std::string s(512, '1');
   s[1] = '.';
   long double d;
   std::from_chars(s.data(), s.data() + s.size(), d);
+#endif
 }