aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-03-10 15:27:41 +0000
committerJonathan Wakely <jwakely@redhat.com>2021-03-10 15:27:41 +0000
commit47cca0288d06bd851e5801d13bbee7d9374b685d (patch)
tree8b285dd460ea4daa307cbf0d9483e92b77129252
parentdddd011113b6ceede733d7ae33eca695c06b181b (diff)
downloadgcc-47cca0288d06bd851e5801d13bbee7d9374b685d.zip
gcc-47cca0288d06bd851e5801d13bbee7d9374b685d.tar.gz
gcc-47cca0288d06bd851e5801d13bbee7d9374b685d.tar.bz2
libstdc++: Fix headers that can't be used as header units [PR 99413]
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.
-rw-r--r--libstdc++-v3/include/bits/align.h1
-rw-r--r--libstdc++-v3/include/bits/codecvt.h3
-rw-r--r--libstdc++-v3/include/bits/enable_special_members.h2
-rw-r--r--libstdc++-v3/include/bits/erase_if.h2
-rw-r--r--libstdc++-v3/include/bits/functional_hash.h1
-rw-r--r--libstdc++-v3/include/bits/invoke.h1
-rw-r--r--libstdc++-v3/include/bits/ostream_insert.h1
-rw-r--r--libstdc++-v3/include/bits/parse_numbers.h1
-rw-r--r--libstdc++-v3/include/bits/predefined_ops.h2
-rw-r--r--libstdc++-v3/include/bits/range_access.h1
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h12
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h1
-rw-r--r--libstdc++-v3/include/bits/stl_uninitialized.h11
-rw-r--r--libstdc++-v3/include/bits/uniform_int_dist.h1
-rw-r--r--libstdc++-v3/include/bits/unique_lock.h1
-rw-r--r--libstdc++-v3/include/debug/assertions.h2
16 files changed, 26 insertions, 17 deletions
diff --git a/libstdc++-v3/include/bits/align.h b/libstdc++-v3/include/bits/align.h
index a81cc3e..eabdaa6 100644
--- a/libstdc++-v3/include/bits/align.h
+++ b/libstdc++-v3/include/bits/align.h
@@ -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)
{
diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h
index af841ed..85f92b1 100644
--- a/libstdc++-v3/include/bits/codecvt.h
+++ b/libstdc++-v3/include/bits/codecvt.h
@@ -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
diff --git a/libstdc++-v3/include/bits/enable_special_members.h b/libstdc++-v3/include/bits/enable_special_members.h
index b772b7e..8361a06 100644
--- a/libstdc++-v3/include/bits/enable_special_members.h
+++ b/libstdc++-v3/include/bits/enable_special_members.h
@@ -32,6 +32,8 @@
#pragma GCC system_header
+#include <bits/c++config.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h
index 796382c..8d1d231 100644
--- a/libstdc++-v3/include/bits/erase_if.h
+++ b/libstdc++-v3/include/bits/erase_if.h
@@ -34,6 +34,8 @@
#if __cplusplus >= 201402L
+#include <bits/c++config.h>
+
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h
index 2024af1..ac1d7e2 100644
--- a/libstdc++-v3/include/bits/functional_hash.h
+++ b/libstdc++-v3/include/bits/functional_hash.h
@@ -32,6 +32,7 @@
#pragma GCC system_header
+#include <type_traits>
#include <bits/hash_bytes.h>
namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/bits/invoke.h b/libstdc++-v3/include/bits/invoke.h
index d8969ea4..3ffcabb 100644
--- a/libstdc++-v3/include/bits/invoke.h
+++ b/libstdc++-v3/include/bits/invoke.h
@@ -37,6 +37,7 @@
#else
#include <type_traits>
+#include <bits/move.h> // forward
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/include/bits/ostream_insert.h b/libstdc++-v3/include/bits/ostream_insert.h
index e5b03f8..72eea8b 100644
--- a/libstdc++-v3/include/bits/ostream_insert.h
+++ b/libstdc++-v3/include/bits/ostream_insert.h
@@ -34,6 +34,7 @@
#include <iosfwd>
#include <bits/cxxabi_forced.h>
+#include <bits/exception_defines.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/include/bits/parse_numbers.h b/libstdc++-v3/include/bits/parse_numbers.h
index ada9156..5618661 100644
--- a/libstdc++-v3/include/bits/parse_numbers.h
+++ b/libstdc++-v3/include/bits/parse_numbers.h
@@ -36,6 +36,7 @@
#if __cplusplus >= 201402L
+#include <type_traits>
#include <ext/numeric_traits.h>
namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h
index b881458..97a8a6c 100644
--- a/libstdc++-v3/include/bits/predefined_ops.h
+++ b/libstdc++-v3/include/bits/predefined_ops.h
@@ -30,6 +30,8 @@
#ifndef _GLIBCXX_PREDEFINED_OPS_H
#define _GLIBCXX_PREDEFINED_OPS_H 1
+#include <bits/move.h>
+
namespace __gnu_cxx
{
namespace __ops
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
index bfb3449..ab26b64 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -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)
{
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index 1e3d71f..fadb661 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -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.
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 385d325..ac8a7c4 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -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>
diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index d28dafa..ace8300 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -56,15 +56,16 @@
#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)
{
diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h
index 3ab5c9a..2d83524 100644
--- a/libstdc++-v3/include/bits/uniform_int_dist.h
+++ b/libstdc++-v3/include/bits/uniform_int_dist.h
@@ -36,6 +36,7 @@
#if __cplusplus > 201703L
# include <concepts>
#endif
+#include <bits/concept_check.h> // __glibcxx_function_requires
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/include/bits/unique_lock.h b/libstdc++-v3/include/bits/unique_lock.h
index 03f1d3b..07edfbb 100644
--- a/libstdc++-v3/include/bits/unique_lock.h
+++ b/libstdc++-v3/include/bits/unique_lock.h
@@ -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)
{
diff --git a/libstdc++-v3/include/debug/assertions.h b/libstdc++-v3/include/debug/assertions.h
index da5fb27..e34061e 100644
--- a/libstdc++-v3/include/debug/assertions.h
+++ b/libstdc++-v3/include/debug/assertions.h
@@ -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)