From e1818265aeae36d17a3f7e4fca5c115cffd3bf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 26 Mar 2025 09:37:08 +0100 Subject: utils: ipc: Do not define variables in signal handler up front MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Defining the variables at the beginning of the function forces the types to be default constructible, which may not be desirable; furthermore, it also forces the move/copy assignment operator to be used when the deserialized value is retrieved. Having `T val = f()` has the advantage of benefitting from potential RVO as well as not requiring `T` to be default constructible, so generate code in that form by calling `deserialize_call()` with `declare=true`. Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- .../ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'utils') diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl index ce3cc5ab..07165821 100644 --- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl +++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl @@ -239,10 +239,7 @@ void {{proxy_name}}::{{method.mojom_name}}IPC( [[maybe_unused]] size_t dataSize, [[maybe_unused]] const std::vector &fds) { -{%- for param in method.parameters %} - {{param|name}} {{param.mojom_name}}; -{%- endfor %} -{{proxy_funcs.deserialize_call(method.parameters, 'data', 'fds', false, false, true, 'dataSize')}} +{{proxy_funcs.deserialize_call(method.parameters, 'data', 'fds', false, true, true, 'dataSize')}} {{method.mojom_name}}.emit({{method.parameters|params_comma_sep}}); } {% endfor %} -- cgit v1.2.1