summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/experimental
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-07-22 14:48:27 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-07-27 12:04:18 +0100
commit16158c96496b537194111526d25e19f268d613b6 (patch)
tree4b77042b0fb21913b7a7e550b24390a5940b8aae /libstdc++-v3/include/experimental
parent261d5a4a459bd49942e53bc83334ccc7154a09d5 (diff)
libstdc++: Remove unnecessary uses of <utility>
The <algorithm> header includes <utility>, with a comment referring to UK-300, a National Body comment on the C++11 draft. That comment proposed to move std::swap to <utility> and then require <algorithm> to include <utility>. The comment was rejected, so we do not need to implement the suggestion. For backwards compatibility with C++03 we do want <algorithm> to define std::swap, but it does so anyway via <bits/move.h>. We don't need the whole of <utility> to do that. A few other headers that need std::swap can include <bits/move.h> to get it, instead of <utility>. There are several headers that include <utility> to get std::pair, but they can use <bits/stl_pair.h> to get it without also including the rel_ops namespace and other contents of <utility>. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/std/algorithm: Do not include <utility>. * include/std/functional: Likewise. * include/std/regex: Include <bits/stl_pair.h> instead of <utility>. * include/debug/map.h: Likewise. * include/debug/multimap.h: Likewise. * include/debug/multiset.h: Likewise. * include/debug/set.h: Likewise. * include/debug/vector: Likewise. * include/bits/fs_path.h: Likewise. * include/bits/unique_ptr.h: Do not include <utility>. * include/experimental/any: Likewise. * include/experimental/executor: Likewise. * include/experimental/memory: Likewise. * include/experimental/optional: Likewise. * include/experimental/socket: Use __exchange instead of std::exchange. * src/filesystem/ops-common.h: Likewise. * testsuite/20_util/default_delete/48631_neg.cc: Adjust expected errors to not use a hardcoded line number. * testsuite/20_util/default_delete/void_neg.cc: Likewise. * testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc: Include <utility> for std::as_const. * testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constrained.cc: Likewise. * testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc: Likewise. * testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constrained.cc: Likewise. * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adjust dg-error line number.
Diffstat (limited to 'libstdc++-v3/include/experimental')
-rw-r--r--libstdc++-v3/include/experimental/any2
-rw-r--r--libstdc++-v3/include/experimental/executor1
-rw-r--r--libstdc++-v3/include/experimental/memory1
-rw-r--r--libstdc++-v3/include/experimental/optional2
-rw-r--r--libstdc++-v3/include/experimental/socket10
5 files changed, 7 insertions, 9 deletions
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index 3bb3e8c4a0a..7d18f267e8b 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -36,8 +36,8 @@
#include <typeinfo>
#include <new>
-#include <utility>
#include <type_traits>
+#include <bits/move.h>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor
index c670f2739b6..4322a7f5caf 100644
--- a/libstdc++-v3/include/experimental/executor
+++ b/libstdc++-v3/include/experimental/executor
@@ -43,7 +43,6 @@
#include <thread>
#include <tuple>
#include <unordered_map>
-#include <utility>
#include <experimental/netfwd>
#include <bits/unique_ptr.h>
#include <experimental/bits/net.h>
diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory
index a74b2402f7a..a89a5ecfa84 100644
--- a/libstdc++-v3/include/experimental/memory
+++ b/libstdc++-v3/include/experimental/memory
@@ -40,7 +40,6 @@
#include <memory>
#include <type_traits>
-#include <utility>
#include <experimental/bits/shared_ptr.h>
#include <bits/functional_hash.h>
diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional
index ae2418f0500..431d23631cf 100644
--- a/libstdc++-v3/include/experimental/optional
+++ b/libstdc++-v3/include/experimental/optional
@@ -32,7 +32,6 @@
#if __cplusplus >= 201402L
-#include <utility>
#include <type_traits>
#include <stdexcept>
#include <new>
@@ -40,6 +39,7 @@
#include <bits/functexcept.h>
#include <bits/functional_hash.h>
#include <bits/enable_special_members.h>
+#include <bits/move.h>
#include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket
index 9db4a245ccf..6d1c114254a 100644
--- a/libstdc++-v3/include/experimental/socket
+++ b/libstdc++-v3/include/experimental/socket
@@ -429,16 +429,16 @@ inline namespace v1
__socket_impl(__socket_impl&& __rhs)
: _M_ctx(__rhs._M_ctx),
- _M_sockfd(std::exchange(__rhs._M_sockfd, -1)),
- _M_bits(std::exchange(__rhs._M_bits, {}))
+ _M_sockfd(std::__exchange(__rhs._M_sockfd, -1)),
+ _M_bits(std::__exchange(__rhs._M_bits, {}))
{ }
__socket_impl&
operator=(__socket_impl&& __rhs)
{
_M_ctx = __rhs._M_ctx;
- _M_sockfd = std::exchange(__rhs._M_sockfd, -1);
- _M_bits = std::exchange(__rhs._M_bits, {});
+ _M_sockfd = std::__exchange(__rhs._M_sockfd, -1);
+ _M_bits = std::__exchange(__rhs._M_bits, {});
return *this;
}
@@ -615,7 +615,7 @@ inline namespace v1
{
__glibcxx_assert(is_open());
cancel(__ec);
- return std::exchange(_M_sockfd, -1);
+ return std::__exchange(_M_sockfd, -1);
}
template<typename _SettableSocketOption>