public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Make more internal headers include their own dependencies
Date: Fri, 16 Sep 2022 23:33:34 +0100	[thread overview]
Message-ID: <20220916223334.602262-1-jwakely@redhat.com> (raw)

Tested x86_64-linux, pushed to trunk.

-- >8 --

This adds required headers to a few internal headers that currently
assume their deps will be included first. It's more robust to make them
include their own dependencies, so that later refactoring or reuse of
those headers in new contexts doesn't break.

libstdc++-v3/ChangeLog:

	* include/bits/stl_algo.h: Include <bits/stl_algobase.h>.
	* include/bits/stl_tempbuf.h: Include headers for __try and
	__catch macros, std::pair, and __gnu_cxx::__numeric_traits.
	* include/bits/stream_iterator.h: Include <iosfwd> and headers
	for std::addressof and std::iterator.
	* include/bits/streambuf_iterator.h: Include header for
	std::iterator.
	* include/std/iterator: Do not include <iosfwd>.
---
 libstdc++-v3/include/bits/stl_algo.h           | 1 +
 libstdc++-v3/include/bits/stl_tempbuf.h        | 4 +++-
 libstdc++-v3/include/bits/stream_iterator.h    | 3 +++
 libstdc++-v3/include/bits/streambuf_iterator.h | 1 +
 libstdc++-v3/include/std/iterator              | 1 -
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 57fa1c1dc55..9cb708ab2fd 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -57,6 +57,7 @@
 #define _STL_ALGO_H 1
 
 #include <bits/algorithmfwd.h>
+#include <bits/stl_algobase.h>
 #include <bits/stl_heap.h>
 #include <bits/stl_tempbuf.h>  // for _Temporary_buffer
 #include <bits/predefined_ops.h>
diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h
index 82f2dc8055f..b13aa3b0fcc 100644
--- a/libstdc++-v3/include/bits/stl_tempbuf.h
+++ b/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -57,8 +57,10 @@
 #define _STL_TEMPBUF_H 1
 
 #include <new>
-#include <bits/stl_algobase.h>
+#include <bits/exception_defines.h>
 #include <bits/stl_construct.h>
+#include <bits/stl_pair.h>
+#include <ext/numeric_traits.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/stream_iterator.h b/libstdc++-v3/include/bits/stream_iterator.h
index 86c5845b835..0a1362a2eea 100644
--- a/libstdc++-v3/include/bits/stream_iterator.h
+++ b/libstdc++-v3/include/bits/stream_iterator.h
@@ -32,6 +32,9 @@
 
 #pragma GCC system_header
 
+#include <iosfwd>
+#include <bits/move.h>
+#include <bits/stl_iterator_base_types.h>
 #include <debug/debug.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h
index 72344c63088..c26ac249e01 100644
--- a/libstdc++-v3/include/bits/streambuf_iterator.h
+++ b/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -33,6 +33,7 @@
 #pragma GCC system_header
 
 #include <streambuf>
+#include <bits/stl_iterator_base_types.h>
 #include <debug/debug.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index 7f8fc50b39d..2da2fb6e4a3 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -61,7 +61,6 @@
 #include <bits/stl_iterator_base_types.h>
 #include <bits/stl_iterator_base_funcs.h>
 #include <bits/stl_iterator.h>
-#include <iosfwd>
 #include <bits/stream_iterator.h>
 #include <bits/streambuf_iterator.h>
 #include <bits/range_access.h>
-- 
2.37.3


                 reply	other threads:[~2022-09-16 22:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220916223334.602262-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).