Skip to content

Commit

Permalink
utils: mojom: Fix build error caused by the mojom tool update
Browse files Browse the repository at this point in the history
The update to the mojom tool in commit d17de86 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<libcamera::ipa::RPi::ProcessParams>::deserialize(std::vector<unsigned char>::const_iterator, std::vector<unsigned char>::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: d17de86 ("utils: ipc: Update mojo")
Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Feb 15, 2024
1 parent e41f899 commit 4a130f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/ipc/generators/mojom_libcamera_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down

0 comments on commit 4a130f9

Please sign in to comment.