From: Jérémie Galarneau Date: Tue, 18 Apr 2023 21:57:46 +0000 (-0400) Subject: Clean-up: clang-tidy autofixes to eventfd and file-descriptor X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b4853cf42d4edb25351a1c772961534ecae458c2;p=lttng-tools.git Clean-up: clang-tidy autofixes to eventfd and file-descriptor eventfd must be marked explicit to prevent erroneous implicit conversions. A destructor is provided since other special member functions are defined (see cppcoreguidelines-special-member-functions). file_descriptor's constructor is replaced by a trivial constructor. Signed-off-by: Jérémie Galarneau Change-Id: I1623a2f8db0d613201a534293f5e1476b779283c --- diff --git a/src/common/eventfd.hpp b/src/common/eventfd.hpp index 39d398ce0..5bcd2d349 100644 --- a/src/common/eventfd.hpp +++ b/src/common/eventfd.hpp @@ -17,11 +17,12 @@ namespace lttng { class eventfd : public file_descriptor { public: /* Throws a posix_error exception on failure to create the underlying resource. */ - eventfd(bool use_semaphore_semantics = true, std::uint64_t initial_value = 0); + explicit eventfd(bool use_semaphore_semantics = true, std::uint64_t initial_value = 0); eventfd(const eventfd&) = delete; eventfd& operator=(const eventfd&) = delete; eventfd(eventfd&&) = delete; void operator=(eventfd&&) = delete; + ~eventfd() = default; /* Throws on error. */ void increment(std::uint64_t value = 1); diff --git a/src/common/file-descriptor.cpp b/src/common/file-descriptor.cpp index 4042c61ce..6f6a6be24 100644 --- a/src/common/file-descriptor.cpp +++ b/src/common/file-descriptor.cpp @@ -23,10 +23,6 @@ bool is_valid_fd(int fd) } } // anonymous namespace -lttng::file_descriptor::file_descriptor() noexcept -{ -} - lttng::file_descriptor::file_descriptor(int raw_fd) noexcept : _raw_fd{ raw_fd } { LTTNG_ASSERT(is_valid_fd(_raw_fd)); diff --git a/src/common/file-descriptor.hpp b/src/common/file-descriptor.hpp index c0076eb9c..b467e2e38 100644 --- a/src/common/file-descriptor.hpp +++ b/src/common/file-descriptor.hpp @@ -15,7 +15,7 @@ namespace lttng { /* RAII wrapper around a UNIX file descriptor. */ class file_descriptor { public: - file_descriptor() noexcept; + file_descriptor() noexcept = default; explicit file_descriptor(int raw_fd) noexcept; file_descriptor(const file_descriptor&) = delete;