diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-06-22 13:30:46 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-06-22 13:30:46 +0300 |
commit | 35033e4699d3356db509e49cb84962679e5c74f5 (patch) | |
tree | a0fabbbbbc48cf4be19493a9a4eebd3f178f7ee4 /include/llfio/v2.0 | |
parent | f6d801ff046e3efe7fcb322accaa0cd5ecf3dcf8 (diff) |
Check for self-move in every move assignment operator.
Diffstat (limited to 'include/llfio/v2.0')
25 files changed, 120 insertions, 0 deletions
diff --git a/include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp b/include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp index 63d63c64..0448de0c 100644 --- a/include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp +++ b/include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp @@ -96,6 +96,10 @@ namespace algorithm cached_parent_handle_adapter &operator=(const cached_parent_handle_adapter &) = default; cached_parent_handle_adapter &operator=(cached_parent_handle_adapter &&o) noexcept { + if(this == &o) + { + return *this; + } this->~cached_parent_handle_adapter(); new(this) cached_parent_handle_adapter(std::move(o)); return *this; diff --git a/include/llfio/v2.0/algorithm/handle_adapter/combining.hpp b/include/llfio/v2.0/algorithm/handle_adapter/combining.hpp index 68d82270..1cc60973 100644 --- a/include/llfio/v2.0/algorithm/handle_adapter/combining.hpp +++ b/include/llfio/v2.0/algorithm/handle_adapter/combining.hpp @@ -575,6 +575,10 @@ namespace algorithm //! Move assignment of combining_handle_adapter permitted combining_handle_adapter &operator=(combining_handle_adapter &&o) noexcept { + if(this == &o) + { + return *this; + } this->~combining_handle_adapter(); new(this) combining_handle_adapter(std::move(o)); return *this; diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp index c95acb2f..2f4366ed 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp @@ -184,6 +184,10 @@ namespace algorithm //! Move assign atomic_append &operator=(atomic_append &&o) noexcept { + if(this == &o) + { + return *this; + } this->~atomic_append(); new(this) atomic_append(std::move(o)); return *this; diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp index c64817a6..52de3442 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp @@ -179,6 +179,10 @@ namespace algorithm } entities_guard &operator=(entities_guard &&o) noexcept { + if(this == &o) + { + return *this; + } this->~entities_guard(); new(this) entities_guard(std::move(o)); return *this; diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp index dc63d81c..8efd02ea 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp @@ -95,6 +95,10 @@ namespace algorithm //! Move assign byte_ranges &operator=(byte_ranges &&o) noexcept { + if(this == &o) + { + return *this; + } _h = std::move(o._h); return *this; } diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp index a62c5ef6..11939df9 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp @@ -97,6 +97,10 @@ namespace algorithm //! Move assign lock_files &operator=(lock_files &&o) noexcept { + if(this == &o) + { + return *this; + } this->~lock_files(); new(this) lock_files(std::move(o)); return *this; diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/safe_byte_ranges.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/safe_byte_ranges.hpp index 1e094008..0cdca0a6 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/safe_byte_ranges.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/safe_byte_ranges.hpp @@ -144,6 +144,10 @@ namespace algorithm //! Move assign safe_byte_ranges &operator=(safe_byte_ranges &&o) noexcept { + if(this == &o) + { + return *this; + } _p = std::move(o._p); return *this; } diff --git a/include/llfio/v2.0/algorithm/trivial_vector.hpp b/include/llfio/v2.0/algorithm/trivial_vector.hpp index 2c161dec..f54ac974 100644 --- a/include/llfio/v2.0/algorithm/trivial_vector.hpp +++ b/include/llfio/v2.0/algorithm/trivial_vector.hpp @@ -216,6 +216,10 @@ namespace algorithm //! Move assignment trivial_vector_impl &operator=(trivial_vector_impl &&o) noexcept { + if(this == &o) + { + return *this; + } this->~trivial_vector_impl(); new(this) trivial_vector_impl(std::move(o)); return *this; diff --git a/include/llfio/v2.0/detail/impl/traverse.ipp b/include/llfio/v2.0/detail/impl/traverse.ipp index 0b6881f4..f69801a0 100644 --- a/include/llfio/v2.0/detail/impl/traverse.ipp +++ b/include/llfio/v2.0/detail/impl/traverse.ipp @@ -157,6 +157,10 @@ namespace algorithm } workitem &operator=(workitem &&o) noexcept { + if(this == &o) + { + return *this; + } this->~workitem(); new(this) workitem(std::move(o)); return *this; diff --git a/include/llfio/v2.0/directory_handle.hpp b/include/llfio/v2.0/directory_handle.hpp index 936e7b8e..a95272aa 100644 --- a/include/llfio/v2.0/directory_handle.hpp +++ b/include/llfio/v2.0/directory_handle.hpp @@ -135,6 +135,10 @@ public: //! Move assignment buffers_type &operator=(buffers_type &&o) noexcept { + if(this == &o) + { + return *this; + } std::unique_ptr<char[]> kernel_buffer = std::move(_kernel_buffer); size_t kernel_buffer_size = _kernel_buffer_size; this->~buffers_type(); @@ -214,6 +218,10 @@ public: //! Move assignment of directory_handle permitted directory_handle &operator=(directory_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~directory_handle(); new(this) directory_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/fast_random_file_handle.hpp b/include/llfio/v2.0/fast_random_file_handle.hpp index b67fdeed..e710fc3a 100644 --- a/include/llfio/v2.0/fast_random_file_handle.hpp +++ b/include/llfio/v2.0/fast_random_file_handle.hpp @@ -173,6 +173,10 @@ public: //! Move assignment of fast_random_file_handle permitted fast_random_file_handle &operator=(fast_random_file_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~fast_random_file_handle(); new(this) fast_random_file_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/file_handle.hpp b/include/llfio/v2.0/file_handle.hpp index c5e0143f..c012a1c5 100644 --- a/include/llfio/v2.0/file_handle.hpp +++ b/include/llfio/v2.0/file_handle.hpp @@ -122,6 +122,10 @@ public: //! Move assignment of file_handle permitted file_handle &operator=(file_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~file_handle(); new(this) file_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/fs_handle.hpp b/include/llfio/v2.0/fs_handle.hpp index 01ec5de5..2cbabc51 100644 --- a/include/llfio/v2.0/fs_handle.hpp +++ b/include/llfio/v2.0/fs_handle.hpp @@ -84,6 +84,10 @@ protected: //! Move assignment of fs_handle permitted fs_handle &operator=(fs_handle &&o) noexcept { + if(this == &o) + { + return *this; + } _devid = o._devid; _inode = o._inode; o._devid = 0; diff --git a/include/llfio/v2.0/handle.hpp b/include/llfio/v2.0/handle.hpp index 03578315..727157bf 100644 --- a/include/llfio/v2.0/handle.hpp +++ b/include/llfio/v2.0/handle.hpp @@ -257,6 +257,10 @@ public: //! Move assignment of handle handle &operator=(handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~handle(); new(this) handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/io_multiplexer.hpp b/include/llfio/v2.0/io_multiplexer.hpp index 798caf2b..48008286 100644 --- a/include/llfio/v2.0/io_multiplexer.hpp +++ b/include/llfio/v2.0/io_multiplexer.hpp @@ -1176,6 +1176,10 @@ public: awaitable &operator=(const awaitable &) = delete; awaitable &operator=(awaitable &&o) noexcept { + if(this == &o) + { + return *this; + } this->~awaitable(); new(this) awaitable(std::move(o)); return *this; diff --git a/include/llfio/v2.0/lockable_io_handle.hpp b/include/llfio/v2.0/lockable_io_handle.hpp index c07dd40e..9248a48e 100644 --- a/include/llfio/v2.0/lockable_io_handle.hpp +++ b/include/llfio/v2.0/lockable_io_handle.hpp @@ -183,6 +183,10 @@ public: //! Move assign extent_guard &operator=(extent_guard &&o) noexcept { + if(this == &o) + { + return *this; + } unlock(); _h = o._h; _offset = o._offset; @@ -339,6 +343,10 @@ public: unique_file_lock(const unique_file_lock &) = delete; unique_file_lock &operator=(unique_file_lock &&o) noexcept { + if(this == &o) + { + return *this; + } this->~unique_file_lock(); new(this) unique_file_lock(std::move(o)); return *this; diff --git a/include/llfio/v2.0/map_handle.hpp b/include/llfio/v2.0/map_handle.hpp index b6836a36..299010de 100644 --- a/include/llfio/v2.0/map_handle.hpp +++ b/include/llfio/v2.0/map_handle.hpp @@ -117,6 +117,10 @@ public: //! Move assignment of section_handle permitted section_handle &operator=(section_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~section_handle(); new(this) section_handle(std::move(o)); return *this; @@ -495,6 +499,10 @@ public: //! Move assignment of map_handle permitted map_handle &operator=(map_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~map_handle(); new(this) map_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/mapped.hpp b/include/llfio/v2.0/mapped.hpp index 6476a2b0..e1029524 100644 --- a/include/llfio/v2.0/mapped.hpp +++ b/include/llfio/v2.0/mapped.hpp @@ -165,6 +165,10 @@ public: mapped &operator=(const mapped &) = delete; mapped &operator=(mapped &&o) noexcept { + if(this == &o) + { + return *this; + } this->~mapped(); new(this) mapped(std::move(o)); return *this; diff --git a/include/llfio/v2.0/mapped_file_handle.hpp b/include/llfio/v2.0/mapped_file_handle.hpp index 7bd2b96d..02c87834 100644 --- a/include/llfio/v2.0/mapped_file_handle.hpp +++ b/include/llfio/v2.0/mapped_file_handle.hpp @@ -269,6 +269,10 @@ public: //! Move assignment of mapped_file_handle permitted mapped_file_handle &operator=(mapped_file_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~mapped_file_handle(); new(this) mapped_file_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/native_handle_type.hpp b/include/llfio/v2.0/native_handle_type.hpp index ff375e85..116ba57d 100644 --- a/include/llfio/v2.0/native_handle_type.hpp +++ b/include/llfio/v2.0/native_handle_type.hpp @@ -118,6 +118,10 @@ struct native_handle_type // NOLINT //! Move assign constexpr native_handle_type &operator=(native_handle_type &&o) noexcept { + if(this == &o) + { + return *this; + } _init = o._init; behaviour = o.behaviour; o.behaviour = disposition(); diff --git a/include/llfio/v2.0/path_handle.hpp b/include/llfio/v2.0/path_handle.hpp index 816caec3..a931bd42 100644 --- a/include/llfio/v2.0/path_handle.hpp +++ b/include/llfio/v2.0/path_handle.hpp @@ -81,6 +81,10 @@ public: //! Move assignment permitted path_handle &operator=(path_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~path_handle(); new(this) path_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/path_view.hpp b/include/llfio/v2.0/path_view.hpp index 1755ce1e..8fb5787c 100644 --- a/include/llfio/v2.0/path_view.hpp +++ b/include/llfio/v2.0/path_view.hpp @@ -772,6 +772,10 @@ public: c_str &operator=(const c_str &) = delete; c_str &operator=(c_str &&o) noexcept { + if(this == &o) + { + return *this; + } this->~c_str(); new(this) c_str(std::move(o)); return *this; diff --git a/include/llfio/v2.0/pipe_handle.hpp b/include/llfio/v2.0/pipe_handle.hpp index 99036e98..b41c7698 100644 --- a/include/llfio/v2.0/pipe_handle.hpp +++ b/include/llfio/v2.0/pipe_handle.hpp @@ -154,6 +154,10 @@ public: //! Move assignment of `pipe_handle` permitted pipe_handle &operator=(pipe_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~pipe_handle(); new(this) pipe_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/process_handle.hpp b/include/llfio/v2.0/process_handle.hpp index 8e84c91c..c70cff21 100644 --- a/include/llfio/v2.0/process_handle.hpp +++ b/include/llfio/v2.0/process_handle.hpp @@ -109,6 +109,10 @@ public: //! Move assignment of handle process_handle &operator=(process_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~process_handle(); new(this) process_handle(std::move(o)); return *this; diff --git a/include/llfio/v2.0/symlink_handle.hpp b/include/llfio/v2.0/symlink_handle.hpp index 8f7e7bb8..39706343 100644 --- a/include/llfio/v2.0/symlink_handle.hpp +++ b/include/llfio/v2.0/symlink_handle.hpp @@ -158,6 +158,10 @@ public: //! Move assignment buffers_type &operator=(buffers_type &&o) noexcept { + if(this == &o) + { + return *this; + } this->~buffers_type(); new(this) buffers_type(std::move(o)); return *this; @@ -221,6 +225,10 @@ public: //! Move assignment const_buffers_type &operator=(const_buffers_type &&o) noexcept { + if(this == &o) + { + return *this; + } this->~const_buffers_type(); new(this) const_buffers_type(std::move(o)); return *this; @@ -320,6 +328,10 @@ public: //! Move assignment permitted symlink_handle &operator=(symlink_handle &&o) noexcept { + if(this == &o) + { + return *this; + } this->~symlink_handle(); new(this) symlink_handle(std::move(o)); return *this; |