From e633d85be9bdf179233ee2cc677ec3edac6df168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 13 May 2025 15:00:07 +0200 Subject: utils: codegen: ipc: Simplify `return` statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Returning an expression of type `void` from a function returning `void` is legal, so do not handle those cases specially. Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- .../generators/libcamera_templates/module_ipa_proxy.cpp.tmpl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'utils/codegen') 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 effc8f7d..9a3aadbd 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 @@ -127,13 +127,13 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) {{proxy_funcs.func_sig(proxy_name, method)}} { if (isolate_) - {{"return " if method|method_return_value != "void"}}{{method.mojom_name}}IPC( + return {{method.mojom_name}}IPC( {%- for param in method|method_param_names -%} {{param}}{{- ", " if not loop.last}} {%- endfor -%} ); else - {{"return " if method|method_return_value != "void"}}{{method.mojom_name}}Thread( + return {{method.mojom_name}}Thread( {%- for param in method|method_param_names -%} {{param}}{{- ", " if not loop.last}} {%- endfor -%} @@ -159,16 +159,14 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) state_ = ProxyRunning; thread_.start(); - {{ "return " if method|method_return_value != "void" -}} - proxy_.invokeMethod(&ThreadProxy::start, ConnectionTypeBlocking + return proxy_.invokeMethod(&ThreadProxy::start, ConnectionTypeBlocking {{- ", " if method|method_param_names}} {%- for param in method|method_param_names -%} {{param}}{{- ", " if not loop.last}} {%- endfor -%} ); {%- elif not method|is_async %} - {{ "return " if method|method_return_value != "void" -}} - ipa_->{{method.mojom_name}}( + return ipa_->{{method.mojom_name}}( {%- for param in method|method_param_names -%} {{param}}{{- ", " if not loop.last}} {%- endfor -%} -- cgit v1.2.1