From 4a130f946d0a9cb81061bdc3d2e0a02bbeb389cb Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Thu, 15 Feb 2024 08:04:42 +0000 Subject: [PATCH] utils: mojom: Fix build error caused by the mojom tool update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The update to the mojom tool in commit d17de86904f0 causes build errors with gcc 12.2 release builds. One such error is: In file included from src/libcamera/proxy/worker/raspberrypi_ipa_proxy_worker.cpp:18: In static member function ‘static libcamera::ipa::RPi::ProcessParams libcamera::IPADataSerializer::deserialize(std::vector::const_iterator, std::vector::const_iterator, libcamera::ControlSerializer*)’, inlined from ‘void IPAProxyRPiWorker::readyRead()’ at src/libcamera/proxy/worker/raspberrypi_ipa_proxy_worker.cpp:302:70: include/libcamera/ipa/raspberrypi_ipa_serializer.h:1172:32: error: ‘*(uint32_t*)((char*)&ret + offsetof(libcamera::ipa::RPi::ProcessParams, libcamera::ipa::RPi::ProcessParams::buffers.libcamera::ipa::RPi::BufferIds::bayer))’ may be used uninitialized [-Werror=maybe-uninitialized] 1172 | return ret; The failure is caused by the new auto-generated IPA interface not initialising POD types to a default value. This is because the updated mojom library uses a new mojom.ValueKind class to represent POD types, whereas the interface generator script uses the mojom.Kind class, which is correct for the older mojom library. Fix this breakage by switching the interface generator script to use mojom.ValueKind to test for POD types. Fixes: d17de86904f0 ("utils: ipc: Update mojo") Signed-off-by: Naushir Patuck --- utils/ipc/generators/mojom_libcamera_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ipc/generators/mojom_libcamera_generator.py b/utils/ipc/generators/mojom_libcamera_generator.py index 582818c98..99d905de4 100644 --- a/utils/ipc/generators/mojom_libcamera_generator.py +++ b/utils/ipc/generators/mojom_libcamera_generator.py @@ -72,7 +72,7 @@ def ParamsCommaSep(l): def GetDefaultValue(element): if element.default is not None: return element.default - if type(element.kind) == mojom.Kind: + if type(element.kind) == mojom.ValueKind: return '0' if IsFlags(element): return ''