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/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 1e0955a..522899c 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -87,22 +87,23 @@
{PLDM_STATE_EFFECTER_PDR,
[this](const DBusHandler& dBusIntf, const auto& json,
RepoInterface& repo) {
- pdr_state_effecter::generateStateEffecterPDR<pldm::utils::DBusHandler,
- Handler>(dBusIntf, json,
- *this, repo);
- }},
+ pdr_state_effecter::generateStateEffecterPDR<
+ pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this,
+ repo);
+ }},
{PLDM_NUMERIC_EFFECTER_PDR,
[this](const DBusHandler& dBusIntf, const auto& json,
RepoInterface& repo) {
- pdr_numeric_effecter::generateNumericEffecterPDR<
- pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this, repo);
- }},
+ pdr_numeric_effecter::generateNumericEffecterPDR<
+ pldm::utils::DBusHandler, Handler>(dBusIntf, json, *this,
+ repo);
+ }},
{PLDM_STATE_SENSOR_PDR, [this](const DBusHandler& dBusIntf,
const auto& json, RepoInterface& repo) {
- pdr_state_sensor::generateStateSensorPDR<pldm::utils::DBusHandler,
- Handler>(dBusIntf, json, *this,
- repo);
- }}};
+ pdr_state_sensor::generateStateSensorPDR<pldm::utils::DBusHandler,
+ Handler>(dBusIntf, json,
+ *this, repo);
+ }}};
Type pdrType{};
for (const auto& directory : dir)
@@ -120,16 +121,16 @@
for (const auto& effecter : effecterPDRs)
{
pdrType = effecter.value("pdrType", 0);
- generateHandlers.at(pdrType)(dBusIntf, effecter,
- repo);
+ generateHandlers.at(
+ pdrType)(dBusIntf, effecter, repo);
}
auto sensorPDRs = json.value("sensorPDRs", empty);
for (const auto& sensor : sensorPDRs)
{
pdrType = sensor.value("pdrType", 0);
- generateHandlers.at(pdrType)(dBusIntf, sensor,
- repo);
+ generateHandlers.at(
+ pdrType)(dBusIntf, sensor, repo);
}
}
}
@@ -296,9 +297,9 @@
return CmdHandler::ccOnlyResponse(request, PLDM_ERROR_INVALID_LENGTH);
}
- int rc = decode_set_state_effecter_states_req(request, payloadLength,
- &effecterId, &compEffecterCnt,
- stateField.data());
+ int rc = decode_set_state_effecter_states_req(
+ request, payloadLength, &effecterId, &compEffecterCnt,
+ stateField.data());
if (rc != PLDM_SUCCESS)
{
@@ -378,8 +379,8 @@
const auto& handlers = eventHandlers.at(eventClass);
for (const auto& handler : handlers)
{
- auto rc = handler(request, payloadLength, formatVersion, tid,
- offset);
+ auto rc =
+ handler(request, payloadLength, formatVersion, tid, offset);
if (rc != PLDM_SUCCESS)
{
return CmdHandler::ccOnlyResponse(request, rc);
@@ -414,8 +415,8 @@
uint16_t sensorId{};
uint8_t eventClass{};
size_t eventClassDataOffset{};
- auto eventData = reinterpret_cast<const uint8_t*>(request->payload) +
- eventDataOffset;
+ auto eventData =
+ reinterpret_cast<const uint8_t*>(request->payload) + eventDataOffset;
auto eventDataSize = payloadLength - eventDataOffset;
auto rc = decode_sensor_event_data(eventData, eventDataSize, &sensorId,
@@ -427,8 +428,8 @@
auto eventClassData = reinterpret_cast<const uint8_t*>(request->payload) +
eventDataOffset + eventClassDataOffset;
- auto eventClassDataSize = payloadLength - eventDataOffset -
- eventClassDataOffset;
+ auto eventClassDataSize =
+ payloadLength - eventDataOffset - eventClassDataOffset;
if (eventClass == PLDM_STATE_SENSOR_STATE)
{
@@ -496,12 +497,13 @@
}
const auto& [containerId, entityType, entityInstance] = entityInfo;
- events::StateSensorEntry stateSensorEntry{containerId,
- entityType,
- entityInstance,
- sensorOffset,
- stateSetIds[sensorOffset],
- false};
+ events::StateSensorEntry stateSensorEntry{
+ containerId,
+ entityType,
+ entityInstance,
+ sensorOffset,
+ stateSetIds[sensorOffset],
+ false};
return hostPDRHandler->handleStateSensorEvent(stateSensorEntry,
eventState);
}
@@ -513,17 +515,16 @@
return PLDM_SUCCESS;
}
-int Handler::pldmPDRRepositoryChgEvent(const pldm_msg* request,
- size_t payloadLength,
- uint8_t /*formatVersion*/, uint8_t tid,
- size_t eventDataOffset)
+int Handler::pldmPDRRepositoryChgEvent(
+ const pldm_msg* request, size_t payloadLength, uint8_t /*formatVersion*/,
+ uint8_t tid, size_t eventDataOffset)
{
uint8_t eventDataFormat{};
uint8_t numberOfChangeRecords{};
size_t dataOffset{};
- auto eventData = reinterpret_cast<const uint8_t*>(request->payload) +
- eventDataOffset;
+ auto eventData =
+ reinterpret_cast<const uint8_t*>(request->payload) + eventDataOffset;
auto eventDataSize = payloadLength - eventDataOffset;
auto rc = decode_pldm_pdr_repository_chg_event_data(
@@ -569,8 +570,8 @@
}
rc = getPDRRecordHandles(
- reinterpret_cast<const ChangeEntry*>(changeRecordData +
- dataOffset),
+ reinterpret_cast<const ChangeEntry*>(
+ changeRecordData + dataOffset),
changeRecordDataSize - dataOffset,
static_cast<size_t>(numberOfChangeEntries),
pdrRecordHandles);
@@ -581,8 +582,8 @@
}
}
- changeRecordData += dataOffset +
- (numberOfChangeEntries * sizeof(ChangeEntry));
+ changeRecordData +=
+ dataOffset + (numberOfChangeEntries * sizeof(ChangeEntry));
changeRecordDataSize -=
dataOffset + (numberOfChangeEntries * sizeof(ChangeEntry));
}
@@ -618,10 +619,9 @@
return PLDM_SUCCESS;
}
-int Handler::getPDRRecordHandles(const ChangeEntry* changeEntryData,
- size_t changeEntryDataSize,
- size_t numberOfChangeEntries,
- PDRRecordHandles& pdrRecordHandles)
+int Handler::getPDRRecordHandles(
+ const ChangeEntry* changeEntryData, size_t changeEntryDataSize,
+ size_t numberOfChangeEntries, PDRRecordHandles& pdrRecordHandles)
{
if (numberOfChangeEntries > (changeEntryDataSize / sizeof(ChangeEntry)))
{
@@ -672,11 +672,11 @@
// PresentValue (uint8|sint8|uint16|sint16|uint32|sint32 )
// Size of PendingValue and PresentValue calculated based on size is
// provided in effecter data size
- size_t responsePayloadLength = sizeof(completionCode) +
- sizeof(effecterDataSize) +
- sizeof(effecterOperationalState) +
- getEffecterDataSize(effecterDataSize) +
- getEffecterDataSize(effecterDataSize);
+ size_t responsePayloadLength =
+ sizeof(completionCode) + sizeof(effecterDataSize) +
+ sizeof(effecterOperationalState) +
+ getEffecterDataSize(effecterDataSize) +
+ getEffecterDataSize(effecterDataSize);
Response response(responsePayloadLength + sizeof(pldm_msg_hdr));
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
@@ -698,8 +698,8 @@
Response Handler::setNumericEffecterValue(const pldm_msg* request,
size_t payloadLength)
{
- Response response(sizeof(pldm_msg_hdr) +
- PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES);
+ Response response(
+ sizeof(pldm_msg_hdr) + PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES);
uint16_t effecterId{};
uint8_t effecterDataSize{};
uint8_t effecterValue[4] = {};
@@ -718,9 +718,9 @@
{
const pldm::utils::DBusHandler dBusIntf;
rc = platform_numeric_effecter::setNumericEffecterValueHandler<
- pldm::utils::DBusHandler, Handler>(dBusIntf, *this, effecterId,
- effecterDataSize, effecterValue,
- sizeof(effecterValue));
+ pldm::utils::DBusHandler, Handler>(
+ dBusIntf, *this, effecterId, effecterDataSize, effecterValue,
+ sizeof(effecterValue));
}
return ccOnlyResponse(request, rc);
@@ -810,13 +810,13 @@
return ccOnlyResponse(request, rc);
}
- Response response(sizeof(pldm_msg_hdr) +
- PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
- sizeof(get_sensor_state_field) * comSensorCnt);
+ Response response(
+ sizeof(pldm_msg_hdr) + PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES +
+ sizeof(get_sensor_state_field) * comSensorCnt);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
- rc = encode_get_state_sensor_readings_resp(request->hdr.instance_id, rc,
- comSensorCnt, stateField.data(),
- responsePtr);
+ rc = encode_get_state_sensor_readings_resp(
+ request->hdr.instance_id, rc, comSensorCnt, stateField.data(),
+ responsePtr);
if (rc != PLDM_SUCCESS)
{
return ccOnlyResponse(request, rc);
@@ -973,8 +973,8 @@
void Handler::setEventReceiver()
{
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_SET_EVENT_RECEIVER_REQ_BYTES);
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_SET_EVENT_RECEIVER_REQ_BYTES);
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto instanceId = instanceIdDb->next(eid);
uint8_t eventMessageGlobalEnable =
@@ -995,8 +995,9 @@
return;
}
- auto processSetEventReceiverResponse =
- [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+ auto processSetEventReceiverResponse = [](mctp_eid_t /*eid*/,
+ const pldm_msg* response,
+ size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error("Failed to receive response for setEventReceiver command");