From: Jérémie Galarneau Date: Fri, 22 Mar 2024 19:35:29 +0000 (-0400) Subject: Clean-up: lttng: utils: missing special member functions X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=77c8b540e0389c630764b6298ec71f81ed03c72d;p=lttng-tools.git Clean-up: lttng: utils: missing special member functions clang-tidy warns: warning: class 'session_list' defines a move constructor but does not define a destructor, a copy constructor, a copy assignment operator or a move assignment operator [cppcoreguidelines-special-member-functions] This warning related to the "Rule of Five": If a class requires a custom destructor, copy constructor, or copy assignment operator due to manual resource management, it likely needs to explicitly define all five (including move constructor and move assignment operator) to correctly manage the resources across all types of object copying and moving scenarios. This rule helps prevent resource leaks, double frees, and other common issues related to resource management. Signed-off-by: Jérémie Galarneau Change-Id: I970cd1ab905eb877241f7e559b47349b9371f261 --- diff --git a/src/bin/lttng/utils.hpp b/src/bin/lttng/utils.hpp index dc9c23e29..7f398397a 100644 --- a/src/bin/lttng/utils.hpp +++ b/src/bin/lttng/utils.hpp @@ -67,6 +67,11 @@ public: { } + session_storage(session_storage&) = delete; + session_storage& operator=(const session_storage& other) = delete; + session_storage& operator=(session_storage&& other) = delete; + ~session_storage() = default; + lttng_session_uptr _array = nullptr; std::size_t _count = 0; }; @@ -128,6 +133,11 @@ public: { } + session_list(session_list&) = delete; + session_list& operator=(const session_list& other) = delete; + session_list& operator=(session_list&& other) = delete; + ~session_list() = default; + void resize(std::size_t new_size) noexcept { _container._count = new_size;