diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-09-15 21:02:32 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-09-16 21:47:19 +0100 |
commit | cf0fded5d837bad590eb091d8a3dc4898872560f (patch) | |
tree | 5432be9bb4658aa077cc28353c9ff271a82de82b /libstdc++-v3/include/std/functional | |
parent | 7f4c37099a9f2415e00e94379c1206b3e9185c52 (diff) | |
download | gcc-cf0fded5d837bad590eb091d8a3dc4898872560f.tar.gz |
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.
Diffstat (limited to 'libstdc++-v3/include/std/functional')
-rw-r--r-- | libstdc++-v3/include/std/functional | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 685a3e167ee..c4f75880fd8 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -56,18 +56,22 @@ #include <bits/functional_hash.h> #include <bits/invoke.h> #include <bits/refwrap.h> // std::reference_wrapper and _Mem_fn_traits -#include <bits/std_function.h> // std::function -#if __cplusplus > 201402L -# include <unordered_map> -# include <vector> -# include <array> -# include <bits/stl_algo.h> +#if _GLIBCXX_HOSTED +# include <bits/std_function.h> // std::function +#endif +#if __cplusplus >= 201703L +# if _GLIBCXX_HOSTED +# include <unordered_map> +# include <vector> +# include <array> +# endif +# include <bits/stl_algo.h> // std::search #endif #if __cplusplus > 201703L # include <bits/ranges_cmp.h> # include <compare> #endif -#if __cplusplus > 202002L +#if __cplusplus > 202002L && _GLIBCXX_HOSTED # include <bits/move_only_function.h> #endif @@ -238,7 +242,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Trait that identifies a bind expression. - * + * * Determines if the given type `_Tp` is a function object that * should be treated as a subexpression when evaluating calls to * function objects returned by `std::bind`. @@ -1117,6 +1121,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m; }; +#if _GLIBCXX_HOSTED template<typename _Key, typename _Tp, typename _Hash, typename _Pred> struct __boyer_moore_map_base { @@ -1359,6 +1364,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } return std::make_pair(__last, __last); } +#endif // HOSTED #endif // C++17 #endif // C++14 |