From patchwork Wed Aug 6 15:48:40 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: 24064 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 68DC2BDCC1 for ; Wed, 6 Aug 2025 15:48:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4AB66691F5; Wed, 6 Aug 2025 17:48:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NZjQ34az"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 49E59691F5 for ; Wed, 6 Aug 2025 17:48:46 +0200 (CEST) Received: from pb-laptop.local (185.182.215.213.nat.pool.zt.hu [185.182.215.213]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9A0E1EBA; Wed, 6 Aug 2025 17:47:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754495277; bh=go0PzicxPC7NFbMrKSJiidOh5KZ6u9wdXCJZYNJ5K1Q=; h=From:To:Subject:Date:From; b=NZjQ34azzg7zSRkU002xr6P6uVf9eA5v2d9yX2ox17P6ZfuR71Rgfx74tMxwuI55J JU6l2rruIuHx1pP6iAtKs3cRT+V0tg8wkvYpnHdJDbKUDWWFDgrRJee9t/Ot3jrAvp ISNv7Fn+yUPVNjOPq/sCR/s89+kbdZKsd6ZI6zLQ= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org, Paul Elder Subject: [RFC PATCH v1 1/3] utils: codegen: ipc: Put default values in declaration Date: Wed, 6 Aug 2025 17:48:40 +0200 Message-ID: <20250806154842.597155-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.50.1 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" Instead of generating a constructor to initialize each member to its default value, simply specify the default values in the declaration of the member. Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder --- .../libcamera_templates/definition_functions.tmpl | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl index 8b8509f3d..16d11c309 100644 --- a/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl +++ b/utils/codegen/ipc/generators/libcamera_templates/definition_functions.tmpl @@ -26,13 +26,7 @@ struct {{struct.mojom_name}} { public: #ifndef __DOXYGEN__ - {{struct.mojom_name}}() {%- if struct|has_default_fields %} - :{% endif %} -{%- for field in struct.fields|with_default_values -%} -{{" " if loop.first}}{{field.mojom_name}}({{field|default_value}}){{", " if not loop.last}} -{%- endfor %} - { - } + {{struct.mojom_name}}() = default; {{struct.mojom_name}}( {%- for field in struct.fields -%} @@ -48,9 +42,7 @@ public: #endif {% for field in struct.fields %} - {{field|name}} {{field.mojom_name}}; + {{field|name}} {{field.mojom_name}}{% if field|default_value %}{ {{field|default_value}} }{% endif %}; {%- endfor %} }; {%- endmacro -%} - -