Allow building with boost 1.87
Boost for whatever reason added nodiscard on boost::asio::spawn. Long
term someone likely needs to move this coroutine stuff over to c++20
coroutines, but for now, put in maybe_unused where appropriate.
Change-Id: I72c2039a2bb1e6198a543f89a1820ed3cb78c9df
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index d169367..3d16344 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -20,6 +20,7 @@
#include "selutility.hpp"
#include <boost/algorithm/string.hpp>
+#include <boost/asio/detached.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/process.hpp>
#include <ipmid/api.hpp>
@@ -346,11 +347,12 @@
});
// call once to populate
- (void)boost::asio::spawn(*getIoContext(),
- [](boost::asio::yield_context yield) {
- replaceCacheFru(getSdBus(), yield);
- },
- {});
+ boost::asio::spawn(
+ *getIoContext(),
+ [](boost::asio::yield_context yield) {
+ replaceCacheFru(getSdBus(), yield);
+ },
+ boost::asio::detached);
}
/** @brief implements the read FRU data command
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index ea833ff..1e85a0d 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -20,6 +20,7 @@
#include <dlfcn.h>
#include <boost/algorithm/string.hpp>
+#include <boost/asio/detached.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>
#include <host-cmd-manager.hpp>
@@ -765,7 +766,7 @@
{
// make a copy so the next two moves don't wreak havoc on the stack
sdbusplus::message_t b{m};
- (void)boost::asio::spawn(
+ boost::asio::spawn(
*getIoContext(),
[b = std::move(b)](boost::asio::yield_context yield) {
sdbusplus::message_t m{std::move(b)};
@@ -802,7 +803,7 @@
netFn, "CMD", lg2::hex, cmd);
}
},
- {});
+ boost::asio::detached);
}
#endif /* ALLOW_DEPRECATED_API */
diff --git a/meson.build b/meson.build
index aa6da2a..7e8795a 100644
--- a/meson.build
+++ b/meson.build
@@ -126,7 +126,7 @@
# Dependencies
-boost = dependency('boost', modules: ['coroutine'], required: false)
+boost = dependency('boost', modules: ['context', 'coroutine'], required: false)
if not boost.found()
cmake = import('cmake')