[PATCH] utils: ipc: Fix event functions with no parameters

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Apr 9 17:24:28 CEST 2024


Hi Paul,

Thank you for the patch.

On Tue, Apr 09, 2024 at 07:40:44PM +0900, Paul Elder wrote:
> If an event function is defined with no parameters, there would be a
> compilation error complaining about unused parameters in the generated
> code for the data and dataSize parameters that would normally correspond
> to serialized data. Fix this by simply marking the parameters as
> maybe_unused.
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
>  .../generators/libcamera_templates/module_ipa_proxy.cpp.tmpl  | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
> index c37c4941..238cf4a5 100644
> --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
> +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
> @@ -235,8 +235,8 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
>  }
>  
>  void {{proxy_name}}::{{method.mojom_name}}IPC(
> -	std::vector<uint8_t>::const_iterator data,
> -	size_t dataSize,
> +	[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
> +	[[maybe_unused]] size_t dataSize,

Do you think it would be useful to set [[maybe_unused]] only when there
are no parameters, or would that be overkill ? I suppose it's called
"maybe_unused" and ont "unused" for a reason, so

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  	[[maybe_unused]] const std::vector<SharedFD> &fds)
>  {
>  {%- for param in method.parameters %}

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list