]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix headers that can't be used as header units [PR 99413]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 10 Mar 2021 15:27:41 +0000 (15:27 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 10 Mar 2021 15:27:41 +0000 (15:27 +0000)
This adds missing includes to internal library headers which get
included from more than one other header, so that they can be compiled
as a stand-alone header unit.

For existing use cases these includes are no-ops because they're already
done by the header that includes these files. For compiling them as a
header unit, this ensures that they include what they use.

libstdc++-v3/ChangeLog:

PR libstdc++/99413
* include/bits/align.h: Include debug/assertions.h.
* include/bits/codecvt.h: Include bits/c++config.h.
* include/bits/enable_special_members.h: Likewise.
* include/bits/erase_if.h: Likewise.
* include/bits/functional_hash.h: Include <type_traits>.
* include/bits/invoke.h: Include bits/move.h.
* include/bits/ostream_insert.h: Include bits/exception_defines.h.
* include/bits/parse_numbers.h: Include <type_traits>.
* include/bits/predefined_ops.h: Include bits/c++config.h.
* include/bits/range_access.h: Include bits/stl_iterator.h.
* include/bits/stl_bvector.h: Do not include bits/stl_vector.h.
* include/bits/stl_iterator.h: Include bits/stl_iterator_base_types.h.
* include/bits/stl_uninitialized.h: Include bits/stl_algobase.h.
* include/bits/uniform_int_dist.h: Include bits/concept_check.h.
* include/bits/unique_lock.h: Include bits/std_mutex.h.
* include/debug/assertions.h: Include bits/c++config.h.

16 files changed:
libstdc++-v3/include/bits/align.h
libstdc++-v3/include/bits/codecvt.h
libstdc++-v3/include/bits/enable_special_members.h
libstdc++-v3/include/bits/erase_if.h
libstdc++-v3/include/bits/functional_hash.h
libstdc++-v3/include/bits/invoke.h
libstdc++-v3/include/bits/ostream_insert.h
libstdc++-v3/include/bits/parse_numbers.h
libstdc++-v3/include/bits/predefined_ops.h
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/bits/stl_uninitialized.h
libstdc++-v3/include/bits/uniform_int_dist.h
libstdc++-v3/include/bits/unique_lock.h
libstdc++-v3/include/debug/assertions.h

index a81cc3e7a7b56ba408db540ba6c95c6cfa979ac6..eabdaa6163db0d0c91d76d4db385f1eba684bfad 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <bit>          // std::has_single_bit
 #include <stdint.h>     // uintptr_t
+#include <debug/assertions.h> // _GLIBCXX_DEBUG_ASSERT
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index af841edf947b4bcbcf556e9361cd05784e4bf084..85f92b146505b26101d3de00b5c76b1c16d0cdb5 100644 (file)
@@ -38,6 +38,9 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
+#include <bits/locale_classes.h> // locale::facet
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
index b772b7e4c28737f966fc57bc41e75a6dbd09710f..8361a063b4d2ace813429ab89e196e176ad7dba3 100644 (file)
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
index 796382cc74c60eefe6ba90c4232a9693dd96ddcb..8d1d23168fa90838c6d51782d46346fb76317eb2 100644 (file)
@@ -34,6 +34,8 @@
 
 #if __cplusplus >= 201402L
 
+#include <bits/c++config.h>
+
 namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
index 2024af1e5855c0ebff10f4c0ecfedd316fe109f5..ac1d7e2979e9db8396a5354aeb5bcdb346107fcd 100644 (file)
@@ -32,6 +32,7 @@
 
 #pragma GCC system_header
 
+#include <type_traits>
 #include <bits/hash_bytes.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
index d8969ea49ba82e9e1bc062dc0b2f274386d56dd2..3ffcabbaebef3b6f628bcf383ed7b195011998d6 100644 (file)
@@ -37,6 +37,7 @@
 #else
 
 #include <type_traits>
+#include <bits/move.h> // forward
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index e5b03f8f93a3db05307a17d60c0d32b54da8bf38..72eea8b1d0562275ead3e98dbf093e220bff722e 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <iosfwd>
 #include <bits/cxxabi_forced.h>
+#include <bits/exception_defines.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index ada91567afef4b081c5194fb9ab1ebb6f6a82fc0..56186612f0f1284ee77daa9320ed6accbf591f99 100644 (file)
@@ -36,6 +36,7 @@
 
 #if __cplusplus >= 201402L
 
+#include <type_traits>
 #include <ext/numeric_traits.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
index b8814588b1c5c15004da7d5f4be5db6c921961f4..97a8a6c3dac2d9a2485d6bf4a032a48bf1cb2cd4 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef _GLIBCXX_PREDEFINED_OPS_H
 #define _GLIBCXX_PREDEFINED_OPS_H      1
 
+#include <bits/move.h>
+
 namespace __gnu_cxx
 {
 namespace __ops
index bfb3449a7eedfcfbbda0c6111a199d22033e28e1..ab26b64e44c0d4d74ece30a6bf645813e0ebae00 100644 (file)
@@ -35,6 +35,7 @@
 #if __cplusplus >= 201103L
 #include <initializer_list>
 #include <type_traits>     // common_type_t, make_signed_t
+#include <bits/stl_iterator.h> // reverse_iterator
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index 1e3d71f3a6f146bd960610cff0ef5a9b89c129a6..fadb661510287e71712f1be88d406afb0aa499f7 100644 (file)
@@ -573,18 +573,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); }
     };
 
-_GLIBCXX_END_NAMESPACE_CONTAINER
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace std
-
-// Declare a partial specialization of vector<T, Alloc>.
-#include <bits/stl_vector.h>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
-
   /**
    *  @brief  A specialization of vector for booleans which offers fixed time
    *  access to individual elements in any order.
index 385d32567424db0b3bfb87d77353dfea4d4a79fa..ac8a7c4b1a8aeeba8d301c0b3bdeb877ead01260 100644 (file)
@@ -61,6 +61,7 @@
 #define _STL_ITERATOR_H 1
 
 #include <bits/cpp_type_traits.h>
+#include <bits/stl_iterator_base_types.h>
 #include <ext/type_traits.h>
 #include <bits/move.h>
 #include <bits/ptr_traits.h>
index d28dafafaae187b081769f20ef422545e9da15d3..ace83000b203c904485888bce0d42d880429dec4 100644 (file)
 #ifndef _STL_UNINITIALIZED_H
 #define _STL_UNINITIALIZED_H 1
 
-#if __cplusplus > 201402L
-#include <bits/stl_pair.h>
-#endif
-
 #if __cplusplus >= 201103L
 #include <type_traits>
 #endif
 
-#include <ext/alloc_traits.h>
+#include <bits/stl_algobase.h>    // copy
+#include <ext/alloc_traits.h>     // __alloc_traits
+
+#if __cplusplus >= 201703L
+#include <bits/stl_pair.h>
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index 3ab5c9a669f85fb37da2291ea84960f87ec90a67..2d83524caf622ec43ca99bf3ec3237b3f3392454 100644 (file)
@@ -36,6 +36,7 @@
 #if __cplusplus > 201703L
 # include <concepts>
 #endif
+#include <bits/concept_check.h> // __glibcxx_function_requires
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index 03f1d3b505a22559295d5513cf4f70c4f28fd800..07edfbbccb132c28227b167776c8b8f5db9dd7b9 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <chrono>
 #include <bits/move.h> // for std::swap
+#include <bits/std_mutex.h> // for std::defer_lock_t
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index da5fb278dc03d9faf8cc9948e7611caaf0f450fe..e34061e6baf9a4fe163c5cb744dca6796443118c 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_DEBUG_ASSERTIONS_H
 #define _GLIBCXX_DEBUG_ASSERTIONS_H 1
 
+#include <bits/c++config.h>
+
 #ifndef _GLIBCXX_DEBUG
 
 # define _GLIBCXX_DEBUG_ASSERT(_Condition)