From patchwork Thu May 15 12:00:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 23370 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 68AEFC3220 for ; Thu, 15 May 2025 12:00:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B18DD68D70; Thu, 15 May 2025 14:00:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="iikk8OBB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4352368B5D for ; Thu, 15 May 2025 14:00:18 +0200 (CEST) Received: from pb-laptop.local (185.221.142.248.nat.pool.zt.hu [185.221.142.248]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3539A89A; Thu, 15 May 2025 14:00:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1747310401; bh=iV3AqVrrv/QwfftjgOAa+8a6ln7NaCNcA+pIvxHxPHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iikk8OBBTpbFQR8Ik57v0MGV8ygYGpivv412Q0Hw9eKwDc5n0koWDEGvPXWJsRHNA VmhbMvA0COjrerlk9WeNyWWJ2nZrp8+LKRjiQik1/22hSXJaTq7x4hl3hvG7Un7NFy TT1fsBLZVbvWAXDqx+eMwfhekwIGhzMrjsT/b1j0= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Paul Elder Subject: [RFC PATCH v1 5/8] utils: codegen: ipc: Simplify `return` statements Date: Thu, 15 May 2025 14:00:09 +0200 Message-ID: <20250515120012.3127231-6-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250515120012.3127231-1-barnabas.pocze@ideasonboard.com> References: <20250515120012.3127231-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- .../libcamera_templates/module_ipa_proxy.cpp.tmpl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 effc8f7dd..9a3aadbd2 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 -%}