Give async_send_hander a real constructor
Clang apparently doesn't like std::make_unique calls on structs without
an explicit constructor, and clang-tidy errors out in CI checks. Make
the constructor explicit on both async_send_handler and unpack_userdata.
Tested: Unit tests pass.
A hacked openbmc-build-scripts + bmcweb build pointing at this commit
passes clang-tidy checks.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iab1d2dfdebd5270ded88324c30653f9c3c48727c
diff --git a/include/sdbusplus/asio/detail/async_send_handler.hpp b/include/sdbusplus/asio/detail/async_send_handler.hpp
index dafc7a8..5d33b2a 100644
--- a/include/sdbusplus/asio/detail/async_send_handler.hpp
+++ b/include/sdbusplus/asio/detail/async_send_handler.hpp
@@ -58,14 +58,19 @@
context->handler_(ec, message);
return 0;
}
+
+ explicit unpack_userdata(CompletionToken&& handler) :
+ handler_(std::forward<CompletionToken>(handler))
+ {}
};
-struct async_send_handler
+class async_send_handler
{
sd_bus* bus;
message_t& mesg;
uint64_t timeout;
+ public:
template <typename CompletionToken>
void operator()(CompletionToken&& token)
{
@@ -84,6 +89,10 @@
// without freeing.
context.release();
}
+
+ async_send_handler(sd_bus* busIn, message_t& mesgIn, uint64_t timeoutIn) :
+ bus(busIn), mesg(mesgIn), timeout(timeoutIn)
+ {}
};
} // namespace detail
} // namespace asio