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/common/flight_recorder.hpp b/common/flight_recorder.hpp
index 47afed0..123c2f5 100644
--- a/common/flight_recorder.hpp
+++ b/common/flight_recorder.hpp
@@ -77,8 +77,8 @@
int currentIndex = index++;
tapeRecorder[currentIndex] = std::make_tuple(
pldm::utils::getCurrentSystemTime(), isRequest, buffer);
- index = (currentIndex == FLIGHT_RECORDER_MAX_ENTRIES - 1) ? 0
- : index;
+ index =
+ (currentIndex == FLIGHT_RECORDER_MAX_ENTRIES - 1) ? 0 : index;
}
}
@@ -96,8 +96,8 @@
flightRecorderDumpPath);
for (const auto& message : tapeRecorder)
{
- recorderOutputFile << std::get<FlightRecorderTimeStamp>(message)
- << " : ";
+ recorderOutputFile
+ << std::get<FlightRecorderTimeStamp>(message) << " : ";
if (std::get<ReqOrResponse>(message))
{
recorderOutputFile << "Tx : \n";
diff --git a/common/test/mocked_utils.hpp b/common/test/mocked_utils.hpp
index e42677c..1e7cf6e 100644
--- a/common/test/mocked_utils.hpp
+++ b/common/test/mocked_utils.hpp
@@ -25,8 +25,8 @@
class GetManagedEmptyObject
{
public:
- static pldm::utils::ObjectValueTree getManagedObj(const char* /*service*/,
- const char* /*path*/)
+ static pldm::utils::ObjectValueTree
+ getManagedObj(const char* /*service*/, const char* /*path*/)
{
return pldm::utils::ObjectValueTree{};
}
@@ -35,8 +35,8 @@
class GetManagedObject
{
public:
- static pldm::utils::ObjectValueTree getManagedObj(const char* /*service*/,
- const char* /*path*/)
+ static pldm::utils::ObjectValueTree
+ getManagedObj(const char* /*service*/, const char* /*path*/)
{
return pldm::utils::ObjectValueTree{
{sdbusplus::message::object_path("/foo/bar"),
diff --git a/common/test/pldm_utils_test.cpp b/common/test/pldm_utils_test.cpp
index c750ae3..d00bebd 100644
--- a/common/test/pldm_utils_test.cpp
+++ b/common/test/pldm_utils_test.cpp
@@ -143,9 +143,9 @@
uint16_t entityID = 33;
uint16_t stateSetId = 196;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
@@ -177,9 +177,9 @@
uint16_t entityID = 44;
uint16_t stateSetId = 196;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
@@ -211,9 +211,9 @@
uint16_t entityID = 33;
uint16_t stateSetId = 196;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo);
@@ -227,9 +227,9 @@
auto repo = pldm_pdr_init();
uint8_t tid = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
@@ -288,9 +288,9 @@
uint16_t entityID = 33;
uint16_t stateSetId = 196;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
@@ -345,9 +345,9 @@
uint16_t entityID = 67;
uint16_t stateSetId = 192;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
@@ -403,9 +403,9 @@
uint16_t entityID = 67;
uint16_t stateSetId = 192;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states));
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
@@ -479,9 +479,9 @@
uint16_t entityID = 67;
uint16_t stateSetId = 192;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states) * 3);
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states) * 3);
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
auto state_start = rec->possible_states;
@@ -525,9 +525,9 @@
uint16_t entityID = 67;
uint16_t stateSetId = 192;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_effecter_possible_states) * 3);
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_effecter_possible_states) * 3);
auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data());
auto state_start = rec->possible_states;
@@ -571,9 +571,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
@@ -605,9 +605,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
@@ -639,9 +639,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto record = findStateSensorPDR(tid, entityID, stateSetId, repo);
@@ -655,9 +655,9 @@
auto repo = pldm_pdr_init();
uint8_t tid = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
@@ -716,9 +716,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
@@ -773,9 +773,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
@@ -831,9 +831,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
@@ -874,9 +874,9 @@
&handle),
0);
- std::vector<uint8_t> pdr_third(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states));
+ std::vector<uint8_t> pdr_third(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states));
auto rec_third = reinterpret_cast<pldm_state_sensor_pdr*>(pdr_third.data());
@@ -906,9 +906,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states) * 3);
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states) * 3);
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
auto state_start = rec->possible_states;
@@ -954,9 +954,9 @@
uint16_t entityID = 5;
uint16_t stateSetId = 1;
- std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) -
- sizeof(uint8_t) +
- sizeof(struct state_sensor_possible_states) * 3);
+ std::vector<uint8_t> pdr(
+ sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) +
+ sizeof(struct state_sensor_possible_states) * 3);
auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data());
auto state_start = rec->possible_states;
diff --git a/common/transport.cpp b/common/transport.cpp
index d992415..9641c38 100644
--- a/common/transport.cpp
+++ b/common/transport.cpp
@@ -151,9 +151,8 @@
return pldm_transport_recv_msg(transport, &tid, (void**)&rx, &len);
}
-pldm_requester_rc_t PldmTransport::sendRecvMsg(pldm_tid_t tid, const void* tx,
- size_t txLen, void*& rx,
- size_t& rxLen)
+pldm_requester_rc_t PldmTransport::sendRecvMsg(
+ pldm_tid_t tid, const void* tx, size_t txLen, void*& rx, size_t& rxLen)
{
return pldm_transport_send_recv_msg(transport, tid, tx, txLen, &rx, &rxLen);
}
diff --git a/common/utils.cpp b/common/utils.cpp
index 1cd5a72..e652021 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -27,10 +27,9 @@
namespace utils
{
-std::vector<std::vector<uint8_t>> findStateEffecterPDR(uint8_t /*tid*/,
- uint16_t entityID,
- uint16_t stateSetId,
- const pldm_pdr* repo)
+std::vector<std::vector<uint8_t>>
+ findStateEffecterPDR(uint8_t /*tid*/, uint16_t entityID,
+ uint16_t stateSetId, const pldm_pdr* repo)
{
uint8_t* outData = nullptr;
uint32_t size{};
@@ -80,10 +79,9 @@
return pdrs;
}
-std::vector<std::vector<uint8_t>> findStateSensorPDR(uint8_t /*tid*/,
- uint16_t entityID,
- uint16_t stateSetId,
- const pldm_pdr* repo)
+std::vector<std::vector<uint8_t>>
+ findStateSensorPDR(uint8_t /*tid*/, uint16_t entityID, uint16_t stateSetId,
+ const pldm_pdr* repo)
{
uint8_t* outData = nullptr;
uint32_t size{};
@@ -203,9 +201,8 @@
return true;
}
-std::optional<std::vector<set_effecter_state_field>>
- parseEffecterData(const std::vector<uint8_t>& effecterData,
- uint8_t effecterCount)
+std::optional<std::vector<set_effecter_state_field>> parseEffecterData(
+ const std::vector<uint8_t>& effecterData, uint8_t effecterCount)
{
std::vector<set_effecter_state_field> stateField;
@@ -316,8 +313,8 @@
{
auto setDbusValue = [&dBusMap, this](const auto& variant) {
auto& bus = getBus();
- auto service = getService(dBusMap.objectPath.c_str(),
- dBusMap.interface.c_str());
+ auto service =
+ getService(dBusMap.objectPath.c_str(), dBusMap.interface.c_str());
auto method = bus.new_method_call(
service.c_str(), dBusMap.objectPath.c_str(), dbusProperties, "Set");
method.append(dBusMap.interface.c_str(), dBusMap.propertyName.c_str(),
@@ -388,8 +385,8 @@
{
auto& bus = DBusHandler::getBus();
auto service = getService(objPath, dbusInterface);
- auto method = bus.new_method_call(service.c_str(), objPath, dbusProperties,
- "Get");
+ auto method =
+ bus.new_method_call(service.c_str(), objPath, dbusProperties, "Get");
method.append(dbusInterface, dbusProp);
return bus.call(method, dbusTimeout).unpack<PropertyValue>();
}
@@ -404,14 +401,13 @@
return bus.call(method).unpack<ObjectValueTree>();
}
-PropertyMap
- DBusHandler::getDbusPropertiesVariant(const char* serviceName,
- const char* objPath,
- const char* dbusInterface) const
+PropertyMap DBusHandler::getDbusPropertiesVariant(
+ const char* serviceName, const char* objPath,
+ const char* dbusInterface) const
{
auto& bus = DBusHandler::getBus();
- auto method = bus.new_method_call(serviceName, objPath, dbusProperties,
- "GetAll");
+ auto method =
+ bus.new_method_call(serviceName, objPath, dbusProperties, "GetAll");
method.append(dbusInterface);
return bus.call(method, dbusTimeout).unpack<PropertyMap>();
}
@@ -556,8 +552,8 @@
{
return sensorPdr->sensor_id;
}
- possible_states_start += possibleStateSize + sizeof(setId) +
- sizeof(possibleStateSize);
+ possible_states_start +=
+ possibleStateSize + sizeof(setId) + sizeof(possibleStateSize);
}
}
return PLDM_INVALID_EFFECTER_ID;
@@ -606,8 +602,8 @@
if (!trimStr.empty())
{
dstStr.remove_prefix(dstStr.find_first_not_of(trimStr));
- dstStr.remove_suffix(dstStr.size() - 1 -
- dstStr.find_last_not_of(trimStr));
+ dstStr.remove_suffix(
+ dstStr.size() - 1 - dstStr.find_last_not_of(trimStr));
}
if (!dstStr.empty())
diff --git a/common/utils.hpp b/common/utils.hpp
index 6b8ea7c..5561399 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -106,9 +106,8 @@
* @return[out] parse success and get a valid set_effecter_state_field
* structure, return nullopt means parse failed
*/
-std::optional<std::vector<set_effecter_state_field>>
- parseEffecterData(const std::vector<uint8_t>& effecterData,
- uint8_t effecterCount);
+std::optional<std::vector<set_effecter_state_field>> parseEffecterData(
+ const std::vector<uint8_t>& effecterData, uint8_t effecterCount);
/**
* @brief creates an error log
@@ -312,8 +311,8 @@
auto getDbusProperty(const char* objPath, const char* dbusProp,
const char* dbusInterface)
{
- auto VariantValue = getDbusPropertyVariant(objPath, dbusProp,
- dbusInterface);
+ auto VariantValue =
+ getDbusPropertyVariant(objPath, dbusProp, dbusInterface);
return std::get<Property>(VariantValue);
}
@@ -403,10 +402,8 @@
* @param[in] repo - pointer to BMC's primary PDR repo.
* @return array[array[uint8_t]] - StateEffecterPDRs
*/
-std::vector<std::vector<uint8_t>> findStateEffecterPDR(uint8_t tid,
- uint16_t entityID,
- uint16_t stateSetId,
- const pldm_pdr* repo);
+std::vector<std::vector<uint8_t>> findStateEffecterPDR(
+ uint8_t tid, uint16_t entityID, uint16_t stateSetId, const pldm_pdr* repo);
/** @brief Find State Sensor PDR
* @param[in] tid - PLDM terminus ID.
* @param[in] entityID - entity that can be associated with PLDM State set.
@@ -414,10 +411,8 @@
* @param[in] repo - pointer to BMC's primary PDR repo.
* @return array[array[uint8_t]] - StateSensorPDRs
*/
-std::vector<std::vector<uint8_t>> findStateSensorPDR(uint8_t tid,
- uint16_t entityID,
- uint16_t stateSetId,
- const pldm_pdr* repo);
+std::vector<std::vector<uint8_t>> findStateSensorPDR(
+ uint8_t tid, uint16_t entityID, uint16_t stateSetId, const pldm_pdr* repo);
/** @brief Find sensor id from a state sensor PDR
*