bindings: cxx: mark public classes as final
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 21 Feb 2023 13:28:12 +0000 (14:28 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 21 Feb 2023 13:28:12 +0000 (14:28 +0100)
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>
13 files changed:
bindings/cxx/gpiodcxx/chip-info.hpp
bindings/cxx/gpiodcxx/chip.hpp
bindings/cxx/gpiodcxx/edge-event-buffer.hpp
bindings/cxx/gpiodcxx/edge-event.hpp
bindings/cxx/gpiodcxx/exception.hpp
bindings/cxx/gpiodcxx/info-event.hpp
bindings/cxx/gpiodcxx/line-config.hpp
bindings/cxx/gpiodcxx/line-info.hpp
bindings/cxx/gpiodcxx/line-request.hpp
bindings/cxx/gpiodcxx/line-settings.hpp
bindings/cxx/gpiodcxx/request-builder.hpp
bindings/cxx/gpiodcxx/request-config.hpp
bindings/cxx/gpiodcxx/timestamp.hpp

index ebaf3964d15cd8da0d5deb2af07673af067a8aa3..b6bd0f82c96fbbb21739b347138d0e0367728e27 100644 (file)
@@ -27,7 +27,7 @@ class chip;
 /**
  * @brief Represents an immutable snapshot of GPIO chip information.
  */
-class chip_info
+class chip_info final
 {
 public:
 
index 2eaf155b5e73253eaf113fe028c127f3f04f37a6..2553f8c90e056d090f8d2acc5cfd018a9ebbf03f 100644 (file)
@@ -38,7 +38,7 @@ class request_config;
 /**
  * @brief Represents a GPIO chip.
  */
-class chip
+class chip final
 {
 public:
 
index ff4d2382bb8d175bdb4013601550647160bfc7b0..025517f27ef0feff46cbb63bc133bb2d54d973b7 100644 (file)
@@ -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:
 
index 648165c191eb470bf4d3304375fa1f638522b905..4fde561539ce26a6511c156638583f15f4b1dd88 100644 (file)
@@ -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:
 
index 98b7bc44a394f3932004dc960840a5a6cf9c335c..e89b384d36bf71af28296e979ec9911ffc9aa852 100644 (file)
@@ -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();
 };
 
 /**
index 6f3c0b95b53e8eae35240e9661e14bc1698569c2..e99cbc4d1528818a31be26cf3693b043963bbed9 100644 (file)
@@ -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:
 
index b76fdff4a5a0aa6c9f12d640686838e196346b7a..8a3335c93cfafeb4740722054b4a969f85ec46bb 100644 (file)
@@ -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:
 
index 189d305a3357bf1a079c5c047652b1ada9a9c0d7..26d25a9b09e4e3f07c6be19052efd763cf795146 100644 (file)
@@ -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:
 
index f9f0322de9cfe422097916618eff58a4df657c3c..54a4e00ae03513a0da75effe7de7c65c6b7d514e 100644 (file)
@@ -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:
 
index c18dc52e45569fa63676c23219901ba6e805a156..b043167db3e7b7b5dcede218d3660a87568be8c8 100644 (file)
@@ -29,7 +29,7 @@ class line_config;
 /**
  * @brief Stores GPIO line settings.
  */
-class line_settings
+class line_settings final
 {
 public:
 
index d3ada53632ac133752e08fb0bfe98af22647b71b..321621648ff4c75bdbead8afd1936b31db73a423 100644 (file)
@@ -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:
 
index 70d179ee46645594e5422f44d9aa27de0df2297b..b099eb15cf20b94584468a033e41be355264dad1 100644 (file)
@@ -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:
 
index 5efeb4c2baa987581cb25958465ab4eee854e345..7143ab309e13cd12f94f460abd21e0107162744a 100644 (file)
@@ -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: