On Sun, 16 Nov 2025, 12:53 Jason Merrill, <[email protected]> wrote:

> Tested x86_64-pc-linux-gnu, OK for trunk?
>
>
OK for trunk (some comments below but no changes needed).


> -- 8< --
>
> In my import std testing patch, to work around c++/99000 (include after
> import) I move #includes of the util/ headers above the import.  And so I
> made some adjustments to those headers to support this: adding some missing
> dependencies, making sure that in headers that include both importable and
> non-importable headers, at least one importable header comes first to work
> with my patch to translate e.g. #include <vector> to import
> <bits/stdc++.h>.
>
> The testsuite_iterators.h situation is odd, I don't know what's going on
> with that error.  I'm happy to separate that change from the others if
> desired.
>
> libstdc++-v3/ChangeLog:
>
>         * testsuite/util/testsuite_allocator.h: Move importable headers up.
>         * testsuite/util/testsuite_common_types.h: Likewise.
>         * testsuite/util/testsuite_containers.h: Likewise.
>         * testsuite/util/testsuite_error.h: Move includes inside
>         include guard.
>         * testsuite/util/testsuite_greedy_ops.h: #include <cstddef>.
>         * testsuite/util/testsuite_iterators.h: #include <utility>.
>         * testsuite/util/testsuite_new_operators.h: #include <cstdlib>.
>         * testsuite/util/testsuite_random.h: #include <random>.
> ---
>  .../testsuite/util/testsuite_allocator.h         |  8 ++++----
>  .../testsuite/util/testsuite_common_types.h      | 16 ++++++++--------
>  .../testsuite/util/testsuite_containers.h        |  4 ++--
>  libstdc++-v3/testsuite/util/testsuite_error.h    |  7 ++++---
>  .../testsuite/util/testsuite_greedy_ops.h        |  2 ++
>  .../testsuite/util/testsuite_iterators.h         |  5 ++++-
>  .../testsuite/util/testsuite_new_operators.h     |  1 +
>  libstdc++-v3/testsuite/util/testsuite_random.h   |  1 +
>  8 files changed, 26 insertions(+), 18 deletions(-)
>
> diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h
> b/libstdc++-v3/testsuite/util/testsuite_allocator.h
> index 086685b4ac6..3367b1b1e31 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
> @@ -26,14 +26,14 @@
>  #ifndef _GLIBCXX_TESTSUITE_ALLOCATOR_H
>  #define _GLIBCXX_TESTSUITE_ALLOCATOR_H
>
> -#include <bits/move.h>
> -#include <ext/pointer.h>
> -#include <ext/alloc_traits.h>
> -#include <testsuite_hooks.h>
>  #if __cplusplus >= 201703L
>  # include <memory_resource>
>  # include <new>
>  #endif
> +#include <bits/move.h>
>

This could be removed entirely. It's here for std::move, but the include of
<unordered_map> below bring that in anyway.


+#include <ext/pointer.h>
> +#include <ext/alloc_traits.h>
> +#include <testsuite_hooks.h>
>
>  #if __cplusplus >= 201103L
>  # include <unordered_map>
> diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h
> b/libstdc++-v3/testsuite/util/testsuite_common_types.h
> index cd36a2006a4..98c0f539505 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
> @@ -22,14 +22,6 @@
>  #ifndef _TESTSUITE_COMMON_TYPES_H
>  #define _TESTSUITE_COMMON_TYPES_H 1
>
> -#include <ext/typelist.h>
> -
> -#include <ext/new_allocator.h>
> -#include <ext/malloc_allocator.h>
> -#include <ext/mt_allocator.h>
> -#include <ext/bitmap_allocator.h>
> -#include <ext/pool_allocator.h>
> -
>  #include <algorithm>
>
>  #include <vector>
> @@ -53,6 +45,14 @@ namespace unord = std;
>  namespace unord = std::tr1;
>  #endif
>
> +#include <ext/typelist.h>
> +
> +#include <ext/new_allocator.h>
> +#include <ext/malloc_allocator.h>
> +#include <ext/mt_allocator.h>
> +#include <ext/bitmap_allocator.h>
> +#include <ext/pool_allocator.h>
> +
>  namespace __gnu_test
>  {
>    using __gnu_cxx::typelist::null_type;
> diff --git a/libstdc++-v3/testsuite/util/testsuite_containers.h
> b/libstdc++-v3/testsuite/util/testsuite_containers.h
> index ab0107f79e4..4021585e441 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_containers.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_containers.h
> @@ -20,10 +20,10 @@
>  #ifndef _GLIBCXX_TESTSUITE_CONTAINERS_H
>  #define _GLIBCXX_TESTSUITE_CONTAINERS_H
>
> -#include <bits/boost_concept_check.h>
>  #include <cassert>
> -#include <testsuite_container_traits.h>
>  #include <utility> // for rel_ops.
> +#include <bits/boost_concept_check.h>
> +#include <testsuite_container_traits.h>
>
>  // Container requirement testing.
>  namespace __gnu_test
> diff --git a/libstdc++-v3/testsuite/util/testsuite_error.h
> b/libstdc++-v3/testsuite/util/testsuite_error.h
> index 5295d60b7be..03b09ee036f 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_error.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_error.h
> @@ -19,12 +19,13 @@
>  // <http://www.gnu.org/licenses/>.
>  //
>
> -#include <string>
> -#include <testsuite_hooks.h>
> -
>  #ifndef _TESTSUITE_ERROR_H
>  #define _TESTSUITE_ERROR_H 1
>
> +#include <string>
> +#include <system_error>
> +#include <testsuite_hooks.h>
> +
>  namespace __gnu_test
>  {
>    struct test_category : public std::error_category
> diff --git a/libstdc++-v3/testsuite/util/testsuite_greedy_ops.h
> b/libstdc++-v3/testsuite/util/testsuite_greedy_ops.h
> index 3545848c8be..9103fcb2257 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_greedy_ops.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_greedy_ops.h
> @@ -15,6 +15,8 @@
>  // with this library; see the file COPYING3.  If not see
>  // <http://www.gnu.org/licenses/>.
>
> +#include <cstddef>
> +
>  namespace greedy_ops
>  {
>    struct X
> diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h
> b/libstdc++-v3/testsuite/util/testsuite_iterators.h
> index 41fbcaad366..77e8e4b55e5 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
> @@ -31,7 +31,10 @@
>  #include <bits/stl_iterator_base_types.h>
>
>  #if __cplusplus >= 201103L
> -#include <bits/move.h>
> +// ??? this was <bits/move.h>, but then #including <memory> after this
> header
> +// in 20_util/specialized_algorithms/uninitialized_copy/constrained.cc
> broke
> +// with a mysterious "no match for operator<" between long and
> difference_type.
> +#include <utility>
>

This seems fine as part of this patch, an improvement even.

We could also just make this file include <iterator> instead of just
bits/tl_iterator_base_types.h and then I don't think it would need
<utility> at all. But this change is fine as is.



>  #endif
>
>  #if __cplusplus > 201703L
> diff --git a/libstdc++-v3/testsuite/util/testsuite_new_operators.h
> b/libstdc++-v3/testsuite/util/testsuite_new_operators.h
> index bf0dab88b5b..3e372b8066e 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_new_operators.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_new_operators.h
> @@ -23,6 +23,7 @@
>  #define _GLIBCXX_TESTSUITE_NEW_OPERATORS_H
>
>  #include <new>
> +#include <cstdlib>
>  #include <testsuite_hooks.h>
>
>  namespace __gnu_test
> diff --git a/libstdc++-v3/testsuite/util/testsuite_random.h
> b/libstdc++-v3/testsuite/util/testsuite_random.h
> index 533be4fc29b..68968ae90b0 100644
> --- a/libstdc++-v3/testsuite/util/testsuite_random.h
> +++ b/libstdc++-v3/testsuite/util/testsuite_random.h
> @@ -27,6 +27,7 @@
>  #include <cmath>
>  #include <initializer_list>
>  #include <system_error>
> +#include <random>
>  #include <testsuite_hooks.h>
>
>  namespace __gnu_test
>
> base-commit: 577c0f4a402bfb99d9770e3a90556a3946cb0e18
> prerequisite-patch-id: d5644f7f10210e1e4435b13725800bfa8954c61a
> prerequisite-patch-id: 5a7543abf6c96d2fac464d236225f883414d954f
> prerequisite-patch-id: d37eefb39bebaff0f5d54582d3d53086c7d1fe76
> prerequisite-patch-id: 01b81f59adfbd2c4c1448272735412efab6893ba
> prerequisite-patch-id: bf869efe800bf0c09d27d62fb8e38468a5f2c7e9
> prerequisite-patch-id: de21622412d661aca06c1a87f9a5d5bd0bb9712f
> prerequisite-patch-id: 2bbb5f7c257bc9597c118262800fbab41234251b
> prerequisite-patch-id: 418cff75ec8976f3744371910f271404eb42d32f
> prerequisite-patch-id: d4b1f428e5e0ef735ac025cdc8b3e57a749aebc2
> --
> 2.51.0
>
>

Reply via email to