]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Shuffle header dependencies of <functional>
authorJonathan Wakely <jwakely@redhat.com>
Thu, 6 Oct 2022 13:34:49 +0000 (14:34 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 7 Oct 2022 11:55:33 +0000 (12:55 +0100)
The <new> header is needed by std::function to use placement new, so
include it in <bits/std_function.h> instead of in <functional>.

libstdc++-v3/ChangeLog:

* include/bits/std_function.h: Include <new> but do not include
<bits/stl_function.h>.
* include/std/functional: Do not include <new>.

libstdc++-v3/include/bits/std_function.h
libstdc++-v3/include/std/functional

index f5423a3a5c73f0a8fe9af13639ca92db4d710998..8ab32a6855ebd3ce099bb0cdd29fbd5a16a24453 100644 (file)
 # include <bits/c++0x_warning.h>
 #else
 
-#include <typeinfo>
-#include <bits/stl_function.h>
-#include <bits/invoke.h>
-#include <bits/refwrap.h>
-#include <bits/functexcept.h>
+#include <new>                // placement new
+#include <typeinfo>           // typeid
+#include <bits/invoke.h>      // __invoke_r
+#include <bits/refwrap.h>     // ref wrapper, _Maybe_unary_or_binary_function
+#include <bits/functexcept.h> // __throw_bad_function_call
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index adf9cb1c546b708e4aecbf4adebb5182c4ecbddc..d22acaa3cb82db9625803abe3b169be0943e230b 100644 (file)
 #pragma GCC system_header
 
 #include <bits/c++config.h>
-#include <bits/stl_function.h>
+#include <bits/stl_function.h> // std::equal_to, std::unary_function etc.
 
 #if __cplusplus >= 201103L
 
-#include <new>
 #include <tuple>
 #include <type_traits>
 #include <bits/functional_hash.h>
@@ -67,8 +66,8 @@
 # endif
 # include <bits/stl_algo.h> // std::search
 #endif
-#if __cplusplus > 201703L
-# include <bits/ranges_cmp.h>
+#if __cplusplus >= 202002L
+# include <bits/ranges_cmp.h> // std::identity, ranges::equal_to etc.
 # include <compare>
 #endif
 #if __cplusplus > 202002L && _GLIBCXX_HOSTED