clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I8c84201cb2343a8c8a5507a49de0721a1bee7063
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/requester/handler.hpp b/requester/handler.hpp
index c665822..465e34f 100644
--- a/requester/handler.hpp
+++ b/requester/handler.hpp
@@ -146,9 +146,8 @@
uint8_t numRetries = static_cast<uint8_t>(NUMBER_OF_REQUEST_RETRIES),
std::chrono::milliseconds responseTimeOut =
std::chrono::milliseconds(RESPONSE_TIME_OUT)) :
- pldmTransport(pldmTransport),
- event(event), instanceIdDb(instanceIdDb), verbose(verbose),
- instanceIdExpiryInterval(instanceIdExpiryInterval),
+ pldmTransport(pldmTransport), event(event), instanceIdDb(instanceIdDb),
+ verbose(verbose), instanceIdExpiryInterval(instanceIdExpiryInterval),
numRetries(numRetries), responseTimeOut(responseTimeOut)
{}
@@ -475,8 +474,7 @@
explicit SendRecvMsgOperation(Handler<RequestInterface>& handler,
mctp_eid_t eid, pldm::Request&& request,
R&& r) :
- handler(handler),
- request(std::move(request)), receiver(std::move(r))
+ handler(handler), request(std::move(request)), receiver(std::move(r))
{
auto requestMsg =
reinterpret_cast<const pldm_msg*>(this->request.data());
@@ -611,8 +609,7 @@
explicit SendRecvMsgSender(requester::Handler<RequestInterface>& handler,
mctp_eid_t eid, pldm::Request&& request) :
- handler(handler),
- eid(eid), request(std::move(request))
+ handler(handler), eid(eid), request(std::move(request))
{}
friend auto tag_invoke(stdexec::get_completion_signatures_t,
@@ -658,8 +655,8 @@
{
return SendRecvMsgSender(*this, eid, std::move(request)) |
stdexec::then([](int rc, const pldm_msg* resp, size_t respLen) {
- return std::make_tuple(rc, resp, respLen);
- });
+ return std::make_tuple(rc, resp, respLen);
+ });
}
} // namespace requester
diff --git a/requester/mctp_endpoint_discovery.cpp b/requester/mctp_endpoint_discovery.cpp
index 2780281..d0122c9 100644
--- a/requester/mctp_endpoint_discovery.cpp
+++ b/requester/mctp_endpoint_discovery.cpp
@@ -24,10 +24,9 @@
MctpDiscovery::MctpDiscovery(
sdbusplus::bus_t& bus,
std::initializer_list<MctpDiscoveryHandlerIntf*> list) :
- bus(bus),
- mctpEndpointAddedSignal(
- bus, interfacesAdded(MCTPPath),
- std::bind_front(&MctpDiscovery::discoverEndpoints, this)),
+ bus(bus), mctpEndpointAddedSignal(
+ bus, interfacesAdded(MCTPPath),
+ std::bind_front(&MctpDiscovery::discoverEndpoints, this)),
mctpEndpointRemovedSignal(
bus, interfacesRemoved(MCTPPath),
std::bind_front(&MctpDiscovery::removeEndpoints, this)),
diff --git a/requester/request.hpp b/requester/request.hpp
index 0ba6172..7182c4b 100644
--- a/requester/request.hpp
+++ b/requester/request.hpp
@@ -48,8 +48,7 @@
explicit RequestRetryTimer(sdeventplus::Event& event, uint8_t numRetries,
std::chrono::milliseconds timeout) :
- event(event),
- numRetries(numRetries), timeout(timeout),
+ event(event), numRetries(numRetries), timeout(timeout),
timer(event.get(), std::bind_front(&RequestRetryTimer::callback, this))
{}
diff --git a/requester/test/handler_test.cpp b/requester/test/handler_test.cpp
index f37040f..327817c 100644
--- a/requester/test/handler_test.cpp
+++ b/requester/test/handler_test.cpp
@@ -75,9 +75,9 @@
TEST_F(HandlerTest, singleRequestResponseScenario)
{
- Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
- instanceIdDb, false, seconds(1),
- 2, milliseconds(100));
+ Handler<NiceMock<MockRequest>> reqHandler(
+ pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+ milliseconds(100));
pldm::Request request{};
auto instanceId = instanceIdDb.next(eid);
EXPECT_EQ(instanceId, 0);
@@ -96,9 +96,9 @@
TEST_F(HandlerTest, singleRequestInstanceIdTimerExpired)
{
- Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
- instanceIdDb, false, seconds(1),
- 2, milliseconds(100));
+ Handler<NiceMock<MockRequest>> reqHandler(
+ pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+ milliseconds(100));
pldm::Request request{};
auto instanceId = instanceIdDb.next(eid);
EXPECT_EQ(instanceId, 0);
@@ -115,9 +115,9 @@
TEST_F(HandlerTest, multipleRequestResponseScenario)
{
- Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
- instanceIdDb, false, seconds(2),
- 2, milliseconds(100));
+ Handler<NiceMock<MockRequest>> reqHandler(
+ pldmTransport, event, instanceIdDb, false, seconds(2), 2,
+ milliseconds(100));
pldm::Request request{};
auto instanceId = instanceIdDb.next(eid);
EXPECT_EQ(instanceId, 0);
@@ -156,39 +156,40 @@
TEST_F(HandlerTest, singleRequestResponseScenarioUsingCoroutine)
{
exec::async_scope scope;
- Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
- instanceIdDb, false, seconds(1),
- 2, milliseconds(100));
+ Handler<NiceMock<MockRequest>> reqHandler(
+ pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+ milliseconds(100));
auto instanceId = instanceIdDb.next(eid);
EXPECT_EQ(instanceId, 0);
- scope.spawn(stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
- pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
- const pldm_msg* responseMsg;
- size_t responseLen;
- int rc = PLDM_SUCCESS;
+ scope.spawn(
+ stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
+ pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
+ const pldm_msg* responseMsg;
+ size_t responseLen;
+ int rc = PLDM_SUCCESS;
- auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
- requestPtr->hdr.instance_id = instanceId;
+ auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
+ requestPtr->hdr.instance_id = instanceId;
- try
- {
- std::tie(rc, responseMsg, responseLen) =
- co_await reqHandler.sendRecvMsg(eid, std::move(request));
- }
- catch (...)
- {
- std::rethrow_exception(std::current_exception());
- }
+ try
+ {
+ std::tie(rc, responseMsg, responseLen) =
+ co_await reqHandler.sendRecvMsg(eid, std::move(request));
+ }
+ catch (...)
+ {
+ std::rethrow_exception(std::current_exception());
+ }
- EXPECT_NE(responseLen, 0);
+ EXPECT_NE(responseLen, 0);
- this->pldmResponseCallBack(eid, responseMsg, responseLen);
+ this->pldmResponseCallBack(eid, responseMsg, responseLen);
- EXPECT_EQ(validResponse, true);
- }),
- exec::default_task_context<void>(exec::inline_scheduler{}));
+ EXPECT_EQ(validResponse, true);
+ }),
+ exec::default_task_context<void>(exec::inline_scheduler{}));
pldm::Response mockResponse(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
auto mockResponsePtr =
@@ -202,26 +203,27 @@
TEST_F(HandlerTest, singleRequestCancellationScenarioUsingCoroutine)
{
exec::async_scope scope;
- Handler<NiceMock<MockRequest>> reqHandler(pldmTransport, event,
- instanceIdDb, false, seconds(1),
- 2, milliseconds(100));
+ Handler<NiceMock<MockRequest>> reqHandler(
+ pldmTransport, event, instanceIdDb, false, seconds(1), 2,
+ milliseconds(100));
auto instanceId = instanceIdDb.next(eid);
EXPECT_EQ(instanceId, 0);
bool stopped = false;
- scope.spawn(stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
- pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
- pldm::Response response;
+ scope.spawn(
+ stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
+ pldm::Request request(sizeof(pldm_msg_hdr) + sizeof(uint8_t), 0);
+ pldm::Response response;
- auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
- requestPtr->hdr.instance_id = instanceId;
+ auto requestPtr = reinterpret_cast<pldm_msg*>(request.data());
+ requestPtr->hdr.instance_id = instanceId;
- co_await reqHandler.sendRecvMsg(eid, std::move(request));
+ co_await reqHandler.sendRecvMsg(eid, std::move(request));
- EXPECT_TRUE(false); // unreachable
- }) | stdexec::upon_stopped([&] { stopped = true; }),
- exec::default_task_context<void>(exec::inline_scheduler{}));
+ EXPECT_TRUE(false); // unreachable
+ }) | stdexec::upon_stopped([&] { stopped = true; }),
+ exec::default_task_context<void>(exec::inline_scheduler{}));
scope.request_stop();
@@ -234,9 +236,9 @@
{
struct _
{
- static exec::task<uint8_t> getTIDTask(Handler<MockRequest>& handler,
- mctp_eid_t eid,
- uint8_t instanceId, uint8_t& tid)
+ static exec::task<uint8_t>
+ getTIDTask(Handler<MockRequest>& handler, mctp_eid_t eid,
+ uint8_t instanceId, uint8_t& tid)
{
pldm::Request request(sizeof(pldm_msg_hdr), 0);
auto requestMsg = reinterpret_cast<pldm_msg*>(request.data());
@@ -268,12 +270,13 @@
// Execute a coroutine to send getTID command. The coroutine is suspended
// until reqHandler.handleResponse() is received.
scope.spawn(stdexec::just() | stdexec::let_value([&] -> exec::task<void> {
- uint8_t respTid = 0;
+ uint8_t respTid = 0;
- co_await _::getTIDTask(reqHandler, eid, instanceId, respTid);
+ co_await _::getTIDTask(reqHandler, eid, instanceId,
+ respTid);
- EXPECT_EQ(expectedTid, respTid);
- }),
+ EXPECT_EQ(expectedTid, respTid);
+ }),
exec::default_task_context<void>(exec::inline_scheduler{}));
pldm::Response mockResponse(sizeof(pldm_msg_hdr) + PLDM_GET_TID_RESP_BYTES,
diff --git a/requester/test/mctp_endpoint_discovery_test.cpp b/requester/test/mctp_endpoint_discovery_test.cpp
index df390a0..f955bc0 100644
--- a/requester/test/mctp_endpoint_discovery_test.cpp
+++ b/requester/test/mctp_endpoint_discovery_test.cpp
@@ -30,8 +30,8 @@
EXPECT_CALL(manager2, handleMctpEndpoints(_)).Times(1);
auto mctpDiscoveryHandler = std::make_unique<pldm::MctpDiscovery>(
- bus, std::initializer_list<pldm::MctpDiscoveryHandlerIntf*>{&manager1,
- &manager2});
+ bus, std::initializer_list<pldm::MctpDiscoveryHandlerIntf*>{
+ &manager1, &manager2});
mctpDiscoveryHandler = nullptr;
}