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

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri Mar 20 01:59:16 CET 2020


Hi Laurent,

Thanks for your work.

On 2020-03-20 02:55:50 +0200, 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>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  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
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list