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

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Mar 20 13:44:52 CET 2020


Hi Laurent,

On 20/03/2020 00:55, Laurent Pinchart wrote:
> 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>

LGTM.

Reviewed-by: Kieran Bingham <kieran.bingham 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
--
Kieran


More information about the libcamera-devel mailing list