[4/4] libstdc++: Fix some freestanding test failures
Checks
Commit Message
At some point, <charconv> was added to the non-hosted bit of the C++17
block, which induced failures in many tests.
In addition, some tests also lacked a dg-require-effective-target hosted
tag.
libstdc++-v3/ChangeLog:
* include/precompiled/stdc++.h (C++17): Don't double-include
<charconv>, once with wrong conditions.
* testsuite/18_support/96817.cc: Require hosted.
* testsuite/18_support/bad_exception/59392.cc: Ditto.
* testsuite/20_util/scoped_allocator/108952.cc: Ditto.
* testsuite/20_util/uses_allocator/lwg3527.cc: Ditto.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
Ditto.
---
libstdc++-v3/include/precompiled/stdc++.h | 1 -
libstdc++-v3/testsuite/18_support/96817.cc | 1 +
libstdc++-v3/testsuite/18_support/bad_exception/59392.cc | 1 +
libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc | 1 +
libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc | 1 +
.../29_atomics/atomic/operators/pointer_partial_void.cc | 1 +
6 files changed, 5 insertions(+), 1 deletion(-)
Comments
On Wed, 5 Apr 2023 at 00:13, Arsen Arsenović via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> At some point, <charconv> was added to the non-hosted bit of the C++17
> block, which induced failures in many tests.
>
> In addition, some tests also lacked a dg-require-effective-target hosted
> tag.
>
> libstdc++-v3/ChangeLog:
>
> * include/precompiled/stdc++.h (C++17): Don't double-include
> <charconv>, once with wrong conditions.
> * testsuite/18_support/96817.cc: Require hosted.
> * testsuite/18_support/bad_exception/59392.cc: Ditto.
> * testsuite/20_util/scoped_allocator/108952.cc: Ditto.
> * testsuite/20_util/uses_allocator/lwg3527.cc: Ditto.
Maybe this could be adjusted to not use std::allocator.
> * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
This fails because std::abs s not freestanding (which is surprising,
at least for the integral overloads).
We could adjust the test to define its own abs but maybe it's not worth it.
OK for trunk.
> Ditto.
> ---
> libstdc++-v3/include/precompiled/stdc++.h | 1 -
> libstdc++-v3/testsuite/18_support/96817.cc | 1 +
> libstdc++-v3/testsuite/18_support/bad_exception/59392.cc | 1 +
> libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc | 1 +
> libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc | 1 +
> .../29_atomics/atomic/operators/pointer_partial_void.cc | 1 +
> 6 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
> index bc011986b53..176ad79ff3c 100644
> --- a/libstdc++-v3/include/precompiled/stdc++.h
> +++ b/libstdc++-v3/include/precompiled/stdc++.h
> @@ -75,7 +75,6 @@
>
> #if __cplusplus >= 201703L
> #include <any>
> -#include <charconv>
> // #include <execution>
> #include <optional>
> #include <variant>
> diff --git a/libstdc++-v3/testsuite/18_support/96817.cc b/libstdc++-v3/testsuite/18_support/96817.cc
> index 70938812bd8..073fc337e8f 100644
> --- a/libstdc++-v3/testsuite/18_support/96817.cc
> +++ b/libstdc++-v3/testsuite/18_support/96817.cc
> @@ -17,6 +17,7 @@
>
> // { dg-do run }
> // { dg-additional-options "-pthread" { target pthread } }
> +// { dg-require-effective-target hosted }
>
> // Static init cannot detect recursion for gthreads targets without futexes
> // (and the futex case can only detect it if __libc_single_threaded==true).
> diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
> index ac64e6eddb2..ae972d0535d 100644
> --- a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
> +++ b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
> @@ -17,6 +17,7 @@
>
> // { dg-options "-Wno-deprecated" }
> // { dg-do run { target c++14_down } }
> +// { dg-require-effective-target hosted }
>
> #include <exception>
> #include <cstdlib>
> diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
> index a6b9c67498c..9342f453bf4 100644
> --- a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
> +++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
> @@ -1,4 +1,5 @@
> // { dg-do compile { target c++11 } }
> +// { dg-require-effective-target hosted }
>
> #include <scoped_allocator>
>
> diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
> index ae377f4b5a3..c5a7d513b31 100644
> --- a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
> +++ b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
> @@ -1,5 +1,6 @@
> // { dg-options "-std=gnu++20" }
> // { dg-do compile { target c++20 } }
> +// { dg-require-effective-target hosted }
>
> #include <memory>
>
> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
> index ddb63233a64..e5d221ed15a 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
> @@ -1,5 +1,6 @@
> // { dg-do run { target { c++11_only || c++14_only } } }
> // { dg-require-atomic-builtins "" }
> +// { dg-require-effective-target hosted }
>
> // Copyright (C) 2012-2023 Free Software Foundation, Inc.
> //
> --
> 2.40.0
>
Jonathan Wakely <jwakely@redhat.com> writes:
> On Wed, 5 Apr 2023 at 00:13, Arsen Arsenović via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
>>
>> At some point, <charconv> was added to the non-hosted bit of the C++17
>> block, which induced failures in many tests.
>>
>> In addition, some tests also lacked a dg-require-effective-target hosted
>> tag.
>>
>> libstdc++-v3/ChangeLog:
>>
>> * include/precompiled/stdc++.h (C++17): Don't double-include
>> <charconv>, once with wrong conditions.
>> * testsuite/18_support/96817.cc: Require hosted.
>> * testsuite/18_support/bad_exception/59392.cc: Ditto.
>> * testsuite/20_util/scoped_allocator/108952.cc: Ditto.
>> * testsuite/20_util/uses_allocator/lwg3527.cc: Ditto.
>
> Maybe this could be adjusted to not use std::allocator.
>
>> * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
>
> This fails because std::abs s not freestanding (which is surprising,
> at least for the integral overloads).
> We could adjust the test to define its own abs but maybe it's not worth it.
I can take a look in stage 1.
> OK for trunk.
>
>> Ditto.
>> ---
>> libstdc++-v3/include/precompiled/stdc++.h | 1 -
>> libstdc++-v3/testsuite/18_support/96817.cc | 1 +
>> libstdc++-v3/testsuite/18_support/bad_exception/59392.cc | 1 +
>> libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc | 1 +
>> libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc | 1 +
>> .../29_atomics/atomic/operators/pointer_partial_void.cc | 1 +
>> 6 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
>> index bc011986b53..176ad79ff3c 100644
>> --- a/libstdc++-v3/include/precompiled/stdc++.h
>> +++ b/libstdc++-v3/include/precompiled/stdc++.h
>> @@ -75,7 +75,6 @@
>>
>> #if __cplusplus >= 201703L
>> #include <any>
>> -#include <charconv>
>> // #include <execution>
>> #include <optional>
>> #include <variant>
>> diff --git a/libstdc++-v3/testsuite/18_support/96817.cc b/libstdc++-v3/testsuite/18_support/96817.cc
>> index 70938812bd8..073fc337e8f 100644
>> --- a/libstdc++-v3/testsuite/18_support/96817.cc
>> +++ b/libstdc++-v3/testsuite/18_support/96817.cc
>> @@ -17,6 +17,7 @@
>>
>> // { dg-do run }
>> // { dg-additional-options "-pthread" { target pthread } }
>> +// { dg-require-effective-target hosted }
>>
>> // Static init cannot detect recursion for gthreads targets without futexes
>> // (and the futex case can only detect it if __libc_single_threaded==true).
>> diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
>> index ac64e6eddb2..ae972d0535d 100644
>> --- a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
>> +++ b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
>> @@ -17,6 +17,7 @@
>>
>> // { dg-options "-Wno-deprecated" }
>> // { dg-do run { target c++14_down } }
>> +// { dg-require-effective-target hosted }
>>
>> #include <exception>
>> #include <cstdlib>
>> diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
>> index a6b9c67498c..9342f453bf4 100644
>> --- a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
>> +++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
>> @@ -1,4 +1,5 @@
>> // { dg-do compile { target c++11 } }
>> +// { dg-require-effective-target hosted }
>>
>> #include <scoped_allocator>
>>
>> diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
>> index ae377f4b5a3..c5a7d513b31 100644
>> --- a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
>> +++ b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
>> @@ -1,5 +1,6 @@
>> // { dg-options "-std=gnu++20" }
>> // { dg-do compile { target c++20 } }
>> +// { dg-require-effective-target hosted }
>>
>> #include <memory>
>>
>> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
>> index ddb63233a64..e5d221ed15a 100644
>> --- a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
>> +++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
>> @@ -1,5 +1,6 @@
>> // { dg-do run { target { c++11_only || c++14_only } } }
>> // { dg-require-atomic-builtins "" }
>> +// { dg-require-effective-target hosted }
>>
>> // Copyright (C) 2012-2023 Free Software Foundation, Inc.
>> //
>> --
>> 2.40.0
>>
@@ -75,7 +75,6 @@
#if __cplusplus >= 201703L
#include <any>
-#include <charconv>
// #include <execution>
#include <optional>
#include <variant>
@@ -17,6 +17,7 @@
// { dg-do run }
// { dg-additional-options "-pthread" { target pthread } }
+// { dg-require-effective-target hosted }
// Static init cannot detect recursion for gthreads targets without futexes
// (and the futex case can only detect it if __libc_single_threaded==true).
@@ -17,6 +17,7 @@
// { dg-options "-Wno-deprecated" }
// { dg-do run { target c++14_down } }
+// { dg-require-effective-target hosted }
#include <exception>
#include <cstdlib>
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-effective-target hosted }
#include <scoped_allocator>
@@ -1,5 +1,6 @@
// { dg-options "-std=gnu++20" }
// { dg-do compile { target c++20 } }
+// { dg-require-effective-target hosted }
#include <memory>
@@ -1,5 +1,6 @@
// { dg-do run { target { c++11_only || c++14_only } } }
// { dg-require-atomic-builtins "" }
+// { dg-require-effective-target hosted }
// Copyright (C) 2012-2023 Free Software Foundation, Inc.
//