clang-tidy: cppcoreguidelines-special-member-functions
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 23 Jul 2024 21:00:34 +0000 (21:00 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 01:26:51 +0000 (01:26 +0000)
clang-tidy reports an infringement of
cppcoreguidelines-special-member-functions[1] for
_scoped_rcu_read_lock, iterator, session_not_found_error,
and session_not_found_error.

The copy constructor, move constructor, and assignment operators
are deleted when they are not explicitly defined.

[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c21-if-you-define-or-delete-any-copy-move-or-destructor-function-define-or-delete-them-all

Change-Id: I1ec5470fed8ddf30025d7c71994bff9bafcfbf56
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/session.hpp
src/common/urcu.hpp

index 3f1dda9909947e406d66b283b251025710fcb7b1..1c9871cc287f9bc79b86bd74016723192f04dc96 100644 (file)
@@ -158,6 +158,8 @@ public:
                iterator(const iterator& other) = delete;
                iterator(iterator&& other) = default;
                ~iterator() = default;
+               iterator& operator=(const iterator&) = delete;
+               iterator& operator=(iterator&&) noexcept = delete;
 
                iterator& operator++();
                bool operator==(const iterator& other) const noexcept;
@@ -233,11 +235,15 @@ private:
                        }
                }
 
-               _scoped_rcu_read_lock(_scoped_rcu_read_lock&& other)
+               _scoped_rcu_read_lock(_scoped_rcu_read_lock&& other) noexcept
                {
                        other._armed = false;
                }
 
+               _scoped_rcu_read_lock(_scoped_rcu_read_lock& other) = delete;
+               _scoped_rcu_read_lock& operator=(const _scoped_rcu_read_lock&) = delete;
+               _scoped_rcu_read_lock& operator=(_scoped_rcu_read_lock&&) noexcept = delete;
+
        private:
                bool _armed = true;
        };
@@ -514,6 +520,10 @@ public:
                        }
                }
 
+               query_parameter(query_parameter&& other) noexcept;
+               query_parameter& operator=(const query_parameter&) = delete;
+               query_parameter& operator=(query_parameter&&) noexcept = delete;
+
                query_type type;
                union parameter {
                        explicit parameter(std::string name_) : name(std::move(name_))
@@ -564,6 +574,9 @@ public:
 
        session_not_found_error(const session_not_found_error& other) = default;
        ~session_not_found_error() noexcept override = default;
+       session_not_found_error(session_not_found_error&& other) noexcept = default;
+       session_not_found_error& operator=(const session_not_found_error&) = delete;
+       session_not_found_error& operator=(session_not_found_error&&) noexcept = delete;
 
        query_parameter query_parameter;
 };
index 44a3abaf1c894b8474477afe41b723d07dd96493..efd2dc75913ac218fcd558dd4440317eaea9d7c2 100644 (file)
@@ -118,6 +118,8 @@ public:
                iterator(const iterator& other) = default;
                iterator(iterator&& other) noexcept = default;
                ~iterator() = default;
+               iterator& operator=(const iterator&) = delete;
+               iterator& operator=(iterator&&) noexcept = delete;
 
                /* Move to the next element in the hash table. */
                iterator& operator++()
This page took 0.026326 seconds and 4 git commands to generate.