Fix build failure caused by GCC 15
Rewrite coroutine structured bindings to avoid triggering
-Wmaybe-uninitialized with GCC 15. This diagnostic is stricter
in GCC 15 and falsely detects uninitialized use in co_await
structured bindings.
Ensure compatibility with newer toolchains and maintain
successful builds.
Reference:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118634
Change-Id: Ie168db61695dfb5a401f2fc7c5d76c68e51b2ef2
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/src/EntityManagerInterface.cpp b/src/EntityManagerInterface.cpp
index 581cd1b..e83dea4 100644
--- a/src/EntityManagerInterface.cpp
+++ b/src/EntityManagerInterface.cpp
@@ -74,9 +74,9 @@
while (!ctx.stop_requested())
{
- auto [objectPath, inventoryData] =
- co_await addedMatch
- .next<sdbusplus::message::object_path, SensorData>();
+ auto result = co_await addedMatch
+ .next<sdbusplus::message::object_path, SensorData>();
+ auto& [objectPath, inventoryData] = result;
for (const auto& interfaceName : interfaceNames)
{
@@ -104,9 +104,10 @@
while (!ctx.stop_requested())
{
- auto [objectPath, interfaces] =
+ auto result =
co_await removedMatch
.next<sdbusplus::message::object_path, interface_list_t>();
+ auto& [objectPath, interfaces] = result;
for (const auto& interfaceName : interfaceNames)
{