[libcamera-devel] [PATCH] kms: void-cast 'request' to avoid 'unused-parameter' warnings

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Nov 18 21:10:30 CET 2022


Hi Christian,

Thank you for the patch.

On Fri, Nov 18, 2022 at 09:00:46PM +0100, Christian Rauch via libcamera-devel wrote:
> The parameter 'request' is only used in an assert. assert is only defined
> for debug builds and release builds will not use the parameter, resulting
> in warnings messages only for non-debug builds.
> Fix this by a no-op void cast.
> 
> Signed-off-by: Christian Rauch <Rauch.Christian at gmx.de>
> ---
>  src/apps/cam/kms_sink.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/apps/cam/kms_sink.cpp b/src/apps/cam/kms_sink.cpp
> index 754b061e..de0af51e 100644
> --- a/src/apps/cam/kms_sink.cpp
> +++ b/src/apps/cam/kms_sink.cpp
> @@ -521,6 +521,7 @@ void KMSSink::requestComplete(DRM::AtomicRequest *request)
>  {
>  	std::lock_guard<std::mutex> lock(lock_);
> 
> +	(void) request;

The standard way to do this in C++ is to declare the function as

void KMSSink::requestComplete([[maybe_unused]] DRM::AtomicRequest *request)

>  	assert(queued_ && queued_->drmRequest_.get() == request);
> 
>  	/* Complete the active request, if any. */

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list