bindings: cxx: mark public classes as final
PATCH 1/1 bindings: cxx: mark public classes as final
From: Bartosz Golaszewski <[email protected]>
libgpiod C++ types are not meant to be inherited from. They already don't even provide virtual destructors so mark them explicitly as final. With that the destructors of throwable types can also be made non-virtual.
Signed-off-by Bartosz Golaszewski <[email protected]>
--- bindings/cxx/gpiodcxx/chip-info.hpp | 2 +- bindings/cxx/gpiodcxx/chip.hpp | 2 +- bindings/cxx/gpiodcxx/edge-event-buffer.hpp | 2 +- bindings/cxx/gpiodcxx/edge-event.hpp | 2 +- bindings/cxx/gpiodcxx/exception.hpp | 12 ++++++------ bindings/cxx/gpiodcxx/info-event.hpp | 2 +- bindings/cxx/gpiodcxx/line-config.hpp | 2 +- bindings/cxx/gpiodcxx/line-info.hpp | 2 +- bindings/cxx/gpiodcxx/line-request.hpp | 2 +- bindings/cxx/gpiodcxx/line-settings.hpp | 2 +- bindings/cxx/gpiodcxx/request-builder.hpp | 2 +- bindings/cxx/gpiodcxx/request-config.hpp | 2 +- bindings/cxx/gpiodcxx/timestamp.hpp | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-)
bindings/cxx/gpiodcxx/chip-info.hpp +1 -1
@@ -27,7 +27,7 @@ class chip; /** * @brief Represents an immutable snapshot of GPIO chip information. */ -class chip_info +class chip_info final { public:
bindings/cxx/gpiodcxx/chip.hpp +1 -1
@@ -38,7 +38,7 @@ class request_config; /** * @brief Represents a GPIO chip. */ -class chip +class chip final { public:
bindings/cxx/gpiodcxx/edge-event-buffer.hpp +1 -1
@@ -34,7 +34,7 @@ class line_request; * buffer which improves the performance by avoiding needless memory * allocations. */ -class edge_event_buffer +class edge_event_buffer final { public:
bindings/cxx/gpiodcxx/edge-event.hpp +1 -1
@@ -30,7 +30,7 @@ class edge_event_buffer; /** * @brief Immutable object containing data about a single edge event. */ -class edge_event +class edge_event final { public:
bindings/cxx/gpiodcxx/exception.hpp +6 -6
@@ -25,7 +25,7 @@ namespace gpiod { /** * @brief Exception thrown when an already closed chip is used. */ -class GPIOD_CXX_API chip_closed : public ::std::logic_error +class GPIOD_CXX_API chip_closed final : public ::std::logic_error { public:
@@ -61,13 +61,13 @@ public: */ chip_closed& operator=(chip_closed&& other) noexcept; - virtual ~chip_closed(); + ~chip_closed(); }; /** * @brief Exception thrown when an already released line request is used. */ -class GPIOD_CXX_API request_released : public ::std::logic_error +class GPIOD_CXX_API request_released final : public ::std::logic_error { public:
@@ -103,14 +103,14 @@ public: */ request_released& operator=(request_released&& other) noexcept; - virtual ~request_released(); + ~request_released(); }; /** * @brief Exception thrown when the core C library returns an invalid value * for any of the line_info properties. */ -class GPIOD_CXX_API bad_mapping : public ::std::runtime_error +class GPIOD_CXX_API bad_mapping final : public ::std::runtime_error { public:
@@ -146,7 +146,7 @@ public: */ bad_mapping& operator=(bad_mapping&& other) noexcept; - virtual ~bad_mapping(); + ~bad_mapping(); }; /**
bindings/cxx/gpiodcxx/info-event.hpp +1 -1
@@ -31,7 +31,7 @@ class line_info; /** * @brief Immutable object containing data about a single line info event. */ -class info_event +class info_event final { public:
bindings/cxx/gpiodcxx/line-config.hpp +1 -1
@@ -30,7 +30,7 @@ class line_settings; * @brief Contains a set of line config options used in line requests and * reconfiguration. */ -class line_config +class line_config final { public:
bindings/cxx/gpiodcxx/line-info.hpp +1 -1
@@ -31,7 +31,7 @@ class info_event; * @brief Contains an immutable snapshot of the line's state at the * time when the object of this class was instantiated. */ -class line_info +class line_info final { public:
bindings/cxx/gpiodcxx/line-request.hpp +1 -1
@@ -34,7 +34,7 @@ class line_config; /** * @brief Stores the context of a set of requested GPIO lines. */ -class line_request +class line_request final { public:
bindings/cxx/gpiodcxx/line-settings.hpp +1 -1
@@ -29,7 +29,7 @@ class line_config; /** * @brief Stores GPIO line settings. */ -class line_settings +class line_settings final { public:
bindings/cxx/gpiodcxx/request-builder.hpp +1 -1
@@ -30,7 +30,7 @@ class request_config; /** * @brief Intermediate object storing the configuration for a line request. */ -class request_builder +class request_builder final { public:
bindings/cxx/gpiodcxx/request-config.hpp +1 -1
@@ -32,7 +32,7 @@ class chip; * @brief Stores a set of options passed to the kernel when making a line * request. */ -class request_config +class request_config final { public:
bindings/cxx/gpiodcxx/timestamp.hpp +1 -1
@@ -26,7 +26,7 @@ namespace gpiod { * @brief Stores the edge and info event timestamps as returned by the kernel * and allows to convert them to std::chrono::time_point. */ -class timestamp +class timestamp final { public:
Signature · 1 line
2.37.2