drivers: i3c: fix warning with cpp builds

When compiling with C++ enabled (CONFIG_CPP), add an unused member to
prevent an empty struct; this makes the struct size the same for both C
and C++.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit is contained in:
Ryan McClelland 2025-04-17 12:17:48 -07:00 committed by Benjamin Cabé
commit 26c03005e7

View file

@ -1189,9 +1189,16 @@ struct i3c_driver_config {
/** I3C Primary Controller Dynamic Address */
uint8_t primary_controller_da;
#elif defined(CONFIG_CPP)
/* Empty struct has size 0 in C, size 1 in C++. Force them to be the same. */
uint8_t unused_cpp_size_compatibility;
#endif
};
#if defined(CONFIG_CPP)
BUILD_ASSERT(sizeof(struct i3c_driver_config) >= 1);
#endif
/**
* This structure is common to all I3C drivers and is expected to be the first
* element in the driver's struct driver_data declaration.