diff mbox series

[libgpiod] bindings: cxx: mark public classes as final

Message ID 20230221134103.263443-1-brgl@bgdev.pl
State New
Headers show
Series [libgpiod] bindings: cxx: mark public classes as final | expand

Commit Message

Bartosz Golaszewski Feb. 21, 2023, 1:41 p.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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 <bartosz.golaszewski@linaro.org>
---
 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(-)
diff mbox series

Patch

diff --git a/bindings/cxx/gpiodcxx/chip-info.hpp b/bindings/cxx/gpiodcxx/chip-info.hpp
index ebaf396..b6bd0f8 100644
--- a/bindings/cxx/gpiodcxx/chip-info.hpp
+++ b/bindings/cxx/gpiodcxx/chip-info.hpp
@@ -27,7 +27,7 @@  class chip;
 /**
  * @brief Represents an immutable snapshot of GPIO chip information.
  */
-class chip_info
+class chip_info final
 {
 public:
 
diff --git a/bindings/cxx/gpiodcxx/chip.hpp b/bindings/cxx/gpiodcxx/chip.hpp
index 2eaf155..2553f8c 100644
--- a/bindings/cxx/gpiodcxx/chip.hpp
+++ b/bindings/cxx/gpiodcxx/chip.hpp
@@ -38,7 +38,7 @@  class request_config;
 /**
  * @brief Represents a GPIO chip.
  */
-class chip
+class chip final
 {
 public:
 
diff --git a/bindings/cxx/gpiodcxx/edge-event-buffer.hpp b/bindings/cxx/gpiodcxx/edge-event-buffer.hpp
index ff4d238..025517f 100644
--- a/bindings/cxx/gpiodcxx/edge-event-buffer.hpp
+++ b/bindings/cxx/gpiodcxx/edge-event-buffer.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/edge-event.hpp b/bindings/cxx/gpiodcxx/edge-event.hpp
index 648165c..4fde561 100644
--- a/bindings/cxx/gpiodcxx/edge-event.hpp
+++ b/bindings/cxx/gpiodcxx/edge-event.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/exception.hpp b/bindings/cxx/gpiodcxx/exception.hpp
index 98b7bc4..e89b384 100644
--- a/bindings/cxx/gpiodcxx/exception.hpp
+++ b/bindings/cxx/gpiodcxx/exception.hpp
@@ -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();
 };
 
 /**
diff --git a/bindings/cxx/gpiodcxx/info-event.hpp b/bindings/cxx/gpiodcxx/info-event.hpp
index 6f3c0b9..e99cbc4 100644
--- a/bindings/cxx/gpiodcxx/info-event.hpp
+++ b/bindings/cxx/gpiodcxx/info-event.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/line-config.hpp b/bindings/cxx/gpiodcxx/line-config.hpp
index b76fdff..8a3335c 100644
--- a/bindings/cxx/gpiodcxx/line-config.hpp
+++ b/bindings/cxx/gpiodcxx/line-config.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/line-info.hpp b/bindings/cxx/gpiodcxx/line-info.hpp
index 189d305..26d25a9 100644
--- a/bindings/cxx/gpiodcxx/line-info.hpp
+++ b/bindings/cxx/gpiodcxx/line-info.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/line-request.hpp b/bindings/cxx/gpiodcxx/line-request.hpp
index f9f0322..54a4e00 100644
--- a/bindings/cxx/gpiodcxx/line-request.hpp
+++ b/bindings/cxx/gpiodcxx/line-request.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/line-settings.hpp b/bindings/cxx/gpiodcxx/line-settings.hpp
index c18dc52..b043167 100644
--- a/bindings/cxx/gpiodcxx/line-settings.hpp
+++ b/bindings/cxx/gpiodcxx/line-settings.hpp
@@ -29,7 +29,7 @@  class line_config;
 /**
  * @brief Stores GPIO line settings.
  */
-class line_settings
+class line_settings final
 {
 public:
 
diff --git a/bindings/cxx/gpiodcxx/request-builder.hpp b/bindings/cxx/gpiodcxx/request-builder.hpp
index d3ada53..3216216 100644
--- a/bindings/cxx/gpiodcxx/request-builder.hpp
+++ b/bindings/cxx/gpiodcxx/request-builder.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/request-config.hpp b/bindings/cxx/gpiodcxx/request-config.hpp
index 70d179e..b099eb1 100644
--- a/bindings/cxx/gpiodcxx/request-config.hpp
+++ b/bindings/cxx/gpiodcxx/request-config.hpp
@@ -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:
 
diff --git a/bindings/cxx/gpiodcxx/timestamp.hpp b/bindings/cxx/gpiodcxx/timestamp.hpp
index 5efeb4c..7143ab3 100644
--- a/bindings/cxx/gpiodcxx/timestamp.hpp
+++ b/bindings/cxx/gpiodcxx/timestamp.hpp
@@ -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: