]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Move std::basic_ostream to new internal header [PR99995]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 11 Dec 2024 17:32:39 +0000 (17:32 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 16 Jan 2025 09:41:00 +0000 (09:41 +0000)
commit462a7f45caf78466ee6d9a1256a1e2848e4ec49c
treec146ee405421611a7044faf8b89e35d6dfadafac
parent301a961ffd0567eece55ece42e80a7ba9e855ba0
libstdc++: Move std::basic_ostream to new internal header [PR99995]

This adds <bits/ostream.h> so that other headers don't need to include
all of <ostream>, which pulls in all of <format> since C++23 (for the
std::print and std::println overloads in <ostream>). This new header
allows the constrained operator<< in <bits/unique_ptr.h> to be defined
without all of std::format being compiled.

We could also replace <ostream> with <bits/ostream.h> in all of
<istream>, <fstream>, <sstream>, and <spanstream>. That seems more
likely to cause problems for users who might be expecting <sstream> to
define std::endl, for example. Although the standard doesn't guarantee
that, it is more reasonable than expecting <memory> to define it! We can
look into making those changes for GCC 16.

libstdc++-v3/ChangeLog:

PR libstdc++/99995
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/unique_ptr.h: Include bits/ostream.h instead of
ostream.
* include/std/ostream: Include new header.
* include/bits/ostream.h: New file.
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/ostream.h [new file with mode: 0644]
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/include/std/ostream