]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/std/bit
libstdc++: Add preprocessor conditions for freestanding [PR106953]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 15 Sep 2022 20:02:32 +0000 (21:02 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 16 Sep 2022 20:47:19 +0000 (21:47 +0100)
commitcf0fded5d837bad590eb091d8a3dc4898872560f
tree5432be9bb4658aa077cc28353c9ff271a82de82b
parent7f4c37099a9f2415e00e94379c1206b3e9185c52
libstdc++: Add preprocessor conditions for freestanding [PR106953]

This adds checks for _GLIBCXX_HOSTED to a number of headers which are
not currently installed for freestanding, but need to be for P1642R11
support. For example, <iterator> needs to be installed for C++23
freestanding mode, but without stream iterators and streambuf iterators.
Similarly, <memory> needs to be installed, but without std::allocator
and std::shared_ptr. This change disables the non-freestanding parts of
those headers.

libstdc++-v3/ChangeLog:

PR libstdc++/106953
* include/backward/auto_ptr.h [!_GLIBCXX_HOSTED]: Do not define
shared_ptr members.
* include/bits/alloc_traits.h [!_GLIBCXX_HOSTED]: Do not declare
std::allocator_traits<std::allocator<T>> specializations for
freestanding.
* include/bits/memoryfwd.h [!_GLIBCXX_HOSTED] (allocator): Do
not declare for freestanding.
* include/bits/stl_algo.h [!_GLIBCXX_HOSTED] (stable_partition):
Do not define for freestanding.
[!_GLIBCXX_HOSTED] (merge, stable_sort): Do not use temporary
buffers for freestanding.
* include/bits/stl_algobase.h [!_GLIBCXX_HOSTED]: Do not declare
streambuf iterators and overloaded algorithms using them.
* include/bits/stl_uninitialized.h [!_GLIBCXX_HOSTED]: Do not
define specialized overloads for std::allocator.
* include/bits/unique_ptr.h [!_GLIBCXX_HOSTED] (make_unique)
(make_unique_for_overwrite, operator<<): Do not define for
freestanding.
* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (_Exit): Declare.
Use _GLIBCXX_NOTHROW instead of throw().
* include/debug/assertions.h [!_GLIBCXX_HOSTED]: Ignore
_GLIBCXX_DEBUG for freestanding.
* include/debug/debug.h [!_GLIBCXX_DEBUG]: Likewise.
* include/std/bit [!_GLIBCXX_HOSTED]: Do not use the custom
__int_traits if <ext/numeric_traits.h> is available.
* include/std/functional [!_GLIBCXX_HOSTED]: Do not include
headers that aren't valid for freestanding.
(boyer_moore_searcher, boyer_moore_horspool_searcher): Do not
define for freestanding.
* include/std/iterator [!_GLIBCXX_HOSTED]: Do not include
headers that aren't valid for freestanding.
* include/std/memory [!_GLIBCXX_HOSTED]: Likewise.
* include/std/ranges [!_GLIBCXX_HOSTED] (istream_view): Do not
define for freestanding.
(views::__detail::__is_basic_string_view) [!_GLIBCXX_HOSTED]:
Do not define partial specialization for freestanding.
15 files changed:
libstdc++-v3/include/backward/auto_ptr.h
libstdc++-v3/include/bits/alloc_traits.h
libstdc++-v3/include/bits/memoryfwd.h
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/include/bits/stl_uninitialized.h
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/include/c_global/cstdlib
libstdc++-v3/include/debug/assertions.h
libstdc++-v3/include/debug/debug.h
libstdc++-v3/include/std/bit
libstdc++-v3/include/std/functional
libstdc++-v3/include/std/iterator
libstdc++-v3/include/std/memory
libstdc++-v3/include/std/ranges