]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: testsuite/util adjustments for import std
authorJason Merrill <jason@redhat.com>
Mon, 17 Nov 2025 15:56:40 +0000 (21:26 +0530)
committerJason Merrill <jason@redhat.com>
Mon, 17 Nov 2025 15:56:40 +0000 (21:26 +0530)
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 avoids a failure in
20_util/specialized_algorithms/uninitialized_copy/constrained.cc from
including <memory> after this header, with a mysterious "no match for
operator<" between long and difference_type.

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

libstdc++-v3/testsuite/util/testsuite_allocator.h
libstdc++-v3/testsuite/util/testsuite_common_types.h
libstdc++-v3/testsuite/util/testsuite_containers.h
libstdc++-v3/testsuite/util/testsuite_error.h
libstdc++-v3/testsuite/util/testsuite_greedy_ops.h
libstdc++-v3/testsuite/util/testsuite_iterators.h
libstdc++-v3/testsuite/util/testsuite_new_operators.h
libstdc++-v3/testsuite/util/testsuite_random.h

index 086685b4ac6d4cedc70b25ceded39739d95174ea..3367b1b1e31926aae405dbb4f7d06697abd9dfcb 100644 (file)
 #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>
+#include <ext/pointer.h>
+#include <ext/alloc_traits.h>
+#include <testsuite_hooks.h>
 
 #if __cplusplus >= 201103L
 # include <unordered_map>
index cd36a2006a4c02f7c8b5a426a2c9b7276abfa134..98c0f53950522af22cfb3cc1ac1c517e88caa95d 100644 (file)
 #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;
index ab0107f79e449c950c987fb601dd78f97ab71164..4021585e4415986c96c8f46985d819d25e03b8bc 100644 (file)
 #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
index 5295d60b7be7a4fc23c29f827b557cfec1d60a9b..03b09ee036ff74f1222502c362c56056882f97af 100644 (file)
 // <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
index 3545848c8be4a068ccfdd62a9525fd99df89b4d4..9103fcb225757fb91ce27439a077c1e13e853414 100644 (file)
@@ -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
index 41fbcaad366a651502f7dac12a9941fa9efc7a13..70383b8fde90708511c8881271821369f526f65f 100644 (file)
@@ -31,7 +31,7 @@
 #include <bits/stl_iterator_base_types.h>
 
 #if __cplusplus >= 201103L
-#include <bits/move.h>
+#include <utility>
 #endif
 
 #if __cplusplus > 201703L
index bf0dab88b5b811ccc6988ba4d627ce9c6fdde416..3e372b8066e75e22ea5a3d77954d48b8584f38b0 100644 (file)
@@ -23,6 +23,7 @@
 #define _GLIBCXX_TESTSUITE_NEW_OPERATORS_H
 
 #include <new>
+#include <cstdlib>
 #include <testsuite_hooks.h>
 
 namespace __gnu_test
index 533be4fc29b21368fc849f4f0d2528486b762796..68968ae90b05024f10b3ce47c649f9de11765dc9 100644 (file)
@@ -27,6 +27,7 @@
 #include <cmath>
 #include <initializer_list>
 #include <system_error>
+#include <random>
 #include <testsuite_hooks.h>
 
 namespace __gnu_test