From c1391746082695e0228cb2e7138fb795eaa13bb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 23 Jul 2024 21:00:34 +0000 Subject: [PATCH] clang-tidy: cppcoreguidelines-special-member-functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-sessiond/session.hpp | 15 ++++++++++++++- src/common/urcu.hpp | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/session.hpp b/src/bin/lttng-sessiond/session.hpp index 3f1dda990..1c9871cc2 100644 --- a/src/bin/lttng-sessiond/session.hpp +++ b/src/bin/lttng-sessiond/session.hpp @@ -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; }; diff --git a/src/common/urcu.hpp b/src/common/urcu.hpp index 44a3abaf1..efd2dc759 100644 --- a/src/common/urcu.hpp +++ b/src/common/urcu.hpp @@ -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++() -- 2.34.1