From 19549be1e6bce64edd125929005e0c1659fcbf19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Mon, 4 Aug 2025 15:50:56 +0200 Subject: [PATCH] utils: codegen: ipc: Put default values in declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Laurent Pinchart --- .../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 8b8509f3..16d11c30 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 -%} - -