[libcamera-devel] [PATCH 1/2] libcamera: controls: Move ControlValue size check to controls.cpp

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Mar 20 01:55:50 CET 2020


The size of the ControlValue class is checked by a static_assert() to
avoid accidental ABI breakages. There's no need to perform the check
every time controls.h is included, move it to controls.cpp.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 include/libcamera/controls.h | 2 --
 src/libcamera/controls.cpp   | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 0e111ab72bce..2fca975f7512 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -170,8 +170,6 @@ private:
 		 std::size_t numElements, std::size_t elementSize);
 };
 
-static_assert(sizeof(ControlValue) == 16, "Invalid size of ControlValue class");
-
 class ControlId
 {
 public:
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 4326174adf86..4615e71d7e3c 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -83,6 +83,8 @@ static constexpr size_t ControlValueSize[] = {
  * \brief Abstract type representing the value of a control
  */
 
+static_assert(sizeof(ControlValue) == 16, "Invalid size of ControlValue class");
+
 /**
  * \brief Construct an empty ControlValue.
  */
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list