{"id":23046,"url":"https://patchwork.libcamera.org/api/1.1/patches/23046/?format=json","web_url":"https://patchwork.libcamera.org/patch/23046/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250326101324.1514654-1-barnabas.pocze@ideasonboard.com>","date":"2025-03-26T10:13:24","name":"[RFC,v1] utils: ipc: Do not define variables in signal handler upfront","commit_ref":"e1818265aeae36d17a3f7e4fca5c115cffd3bf80","pull_url":null,"state":"accepted","archived":false,"hash":"336cfe88a35669f92c712b7469fcb6b2f333becb","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23046/mbox/","series":[{"id":5084,"url":"https://patchwork.libcamera.org/api/1.1/series/5084/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5084","date":"2025-03-26T10:13:24","name":"[RFC,v1] utils: ipc: Do not define variables in signal handler upfront","version":1,"mbox":"https://patchwork.libcamera.org/series/5084/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23046/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23046/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5F362C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 10:13:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFA406894B;\n\tWed, 26 Mar 2025 11:13:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C5A768947\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 11:13:28 +0100 (CET)","from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A7A17475\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 11:11:40 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"i+zR1rTB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742983900;\n\tbh=b3aXrCd1RaZy2CY3fZ6V72og5XQUXUGtKR8tuUWbrJk=;\n\th=From:To:Subject:Date:From;\n\tb=i+zR1rTBxfWAZRcs1L1vOUB+znZQSTSDUHjE+AQ2VG/+c7impwH/GE1IrYYPnFIhG\n\tpH/QZ8FNsTwmBXja4/Smy6t3ogjb6P2zuAohS2ApI0qSGVOJfsDfcAz/wGBBIqMjsT\n\tKIQr+CprzM9HR8PQ29XsWZzDuX3ta5fpMsTrnQlw=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[RFC PATCH v1] utils: ipc: Do not define variables in signal handler\n\tupfront","Date":"Wed, 26 Mar 2025 11:13:24 +0100","Message-ID":"<20250326101324.1514654-1-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.49.0","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Defining the variables at the beginning of the function forces the types\nto be default constructible, which may not be desirable; furthermore, it\nalso forces the move/copy assignment operator to be used when the\ndeserialized value is retrieved.\n\nHaving `T val = f()` has the advantage of benefitting from potential RVO\nas well as not requiring `T` to be default constructible, so generate\ncode in that form by calling `deserialize_call()` with `declare=true`.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n .../generators/libcamera_templates/module_ipa_proxy.cpp.tmpl | 5 +----\n 1 file changed, 1 insertion(+), 4 deletions(-)","diff":"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\nindex ce3cc5ab6..07165821e 100644\n--- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\n+++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\n@@ -239,10 +239,7 @@ void {{proxy_name}}::{{method.mojom_name}}IPC(\n \t[[maybe_unused]] size_t dataSize,\n \t[[maybe_unused]] const std::vector<SharedFD> &fds)\n {\n-{%- for param in method.parameters %}\n-\t{{param|name}} {{param.mojom_name}};\n-{%- endfor %}\n-{{proxy_funcs.deserialize_call(method.parameters, 'data', 'fds', false, false, true, 'dataSize')}}\n+{{proxy_funcs.deserialize_call(method.parameters, 'data', 'fds', false, true, true, 'dataSize')}}\n \t{{method.mojom_name}}.emit({{method.parameters|params_comma_sep}});\n }\n {% endfor %}\n","prefixes":["RFC","v1"]}