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: I7b90380845efee6bf6a1fe342a793d71aa9ff181
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 1f65fb2..68b2c7c 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -24,14 +24,13 @@
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
-PowerSupply::PowerSupply(sdbusplus::bus_t& bus, const std::string& invpath,
- std::uint8_t i2cbus, std::uint16_t i2caddr,
- const std::string& driver,
- const std::string& gpioLineName,
- std::function<bool()>&& callback) :
- bus(bus),
- inventoryPath(invpath), bindPath("/sys/bus/i2c/drivers/" + driver),
- isPowerOn(std::move(callback)), driverName(driver)
+PowerSupply::PowerSupply(
+ sdbusplus::bus_t& bus, const std::string& invpath, std::uint8_t i2cbus,
+ std::uint16_t i2caddr, const std::string& driver,
+ const std::string& gpioLineName, std::function<bool()>&& callback) :
+ bus(bus), inventoryPath(invpath),
+ bindPath("/sys/bus/i2c/drivers/" + driver), isPowerOn(std::move(callback)),
+ driverName(driver)
{
if (inventoryPath.empty())
{
@@ -383,13 +382,13 @@
{
if (statusWord != statusWordOld)
{
- log<level::ERR>(std::format("{} FANS fault/warning: "
- "STATUS_WORD = {:#06x}, "
- "STATUS_MFR_SPECIFIC = {:#04x}, "
- "STATUS_FANS_1_2 = {:#04x}",
- shortName, statusWord, statusMFR,
- statusFans12)
- .c_str());
+ log<level::ERR>(
+ std::format("{} FANS fault/warning: "
+ "STATUS_WORD = {:#06x}, "
+ "STATUS_MFR_SPECIFIC = {:#04x}, "
+ "STATUS_FANS_1_2 = {:#04x}",
+ shortName, statusWord, statusMFR, statusFans12)
+ .c_str());
}
fanFault++;
}
@@ -589,8 +588,8 @@
statusVout = pmbusIntf->read(status0Vout, Type::Debug);
statusIout = pmbusIntf->read(STATUS_IOUT, Type::Debug);
statusFans12 = pmbusIntf->read(STATUS_FANS_1_2, Type::Debug);
- statusTemperature = pmbusIntf->read(STATUS_TEMPERATURE,
- Type::Debug);
+ statusTemperature =
+ pmbusIntf->read(STATUS_TEMPERATURE, Type::Debug);
analyzeCMLFault();
@@ -859,8 +858,8 @@
const std::size_t& vpdSize)
{
std::string vpdValue;
- const std::regex illegalVPDRegex = std::regex("[^[:alnum:]]",
- std::regex::basic);
+ const std::regex illegalVPDRegex =
+ std::regex("[^[:alnum:]]", std::regex::basic);
try
{
@@ -1013,8 +1012,8 @@
try
{
- auto service = util::getService(INVENTORY_OBJ_PATH,
- INVENTORY_MGR_IFACE, bus);
+ auto service =
+ util::getService(INVENTORY_OBJ_PATH, INVENTORY_MGR_IFACE, bus);
if (service.empty())
{
@@ -1022,9 +1021,9 @@
return;
}
- auto method = bus.new_method_call(service.c_str(),
- INVENTORY_OBJ_PATH,
- INVENTORY_MGR_IFACE, "Notify");
+ auto method =
+ bus.new_method_call(service.c_str(), INVENTORY_OBJ_PATH,
+ INVENTORY_MGR_IFACE, "Notify");
method.append(std::move(object));
@@ -1051,8 +1050,8 @@
try
{
// Read max_power_out, should be direct format
- auto maxPowerOutStr = pmbusIntf->readString(MFR_POUT_MAX,
- Type::HwmonDeviceDebug);
+ auto maxPowerOutStr =
+ pmbusIntf->readString(MFR_POUT_MAX, Type::HwmonDeviceDebug);
log<level::INFO>(std::format("{} MFR_POUT_MAX read {}", shortName,
maxPowerOutStr)
.c_str());
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 32da768..3195a58 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -167,8 +167,8 @@
// For each object in the array of objects, I want to get properties
// from the service, path, and interface.
- auto properties = getAllProperties(bus, path, IBMCFFPSInterface,
- service);
+ auto properties =
+ getAllProperties(bus, path, IBMCFFPSInterface, service);
getPSUProperties(properties);
}
@@ -232,10 +232,10 @@
presline = *preslineptr;
}
- auto invMatch = std::find_if(psus.begin(), psus.end(),
- [&invpath](auto& psu) {
- return psu->getInventoryPath() == invpath;
- });
+ auto invMatch =
+ std::find_if(psus.begin(), psus.end(), [&invpath](auto& psu) {
+ return psu->getInventoryPath() == invpath;
+ });
if (invMatch != psus.end())
{
// This power supply has the same inventory path as the one with
@@ -348,8 +348,8 @@
{
try
{
- util::DbusSubtree subtree = util::getSubTree(bus, INVENTORY_OBJ_PATH,
- supportedConfIntf, 0);
+ util::DbusSubtree subtree =
+ util::getSubTree(bus, INVENTORY_OBJ_PATH, supportedConfIntf, 0);
if (subtree.empty())
{
throw std::runtime_error("Supported Configuration Not Found");
@@ -520,8 +520,8 @@
{
additionalData["_PID"] = std::to_string(getpid());
- auto service = util::getService(loggingObjectPath,
- loggingCreateInterface, bus);
+ auto service =
+ util::getService(loggingObjectPath, loggingCreateInterface, bus);
if (service.empty())
{
@@ -583,9 +583,10 @@
void PSUManager::analyze()
{
- auto syncHistoryRequired = std::any_of(
- psus.begin(), psus.end(),
- [](const auto& psu) { return psu->isSyncHistoryRequired(); });
+ auto syncHistoryRequired =
+ std::any_of(psus.begin(), psus.end(), [](const auto& psu) {
+ return psu->isSyncHistoryRequired();
+ });
if (syncHistoryRequired)
{
syncHistory();
@@ -630,8 +631,8 @@
// hexadecimal format.
additionalData["STATUS_WORD"] =
std::format("{:#04x}", psu->getStatusWord());
- additionalData["STATUS_MFR"] = std::format("{:#02x}",
- psu->getMFRFault());
+ additionalData["STATUS_MFR"] =
+ std::format("{:#02x}", psu->getMFRFault());
// If there are faults being reported, they possibly could be
// related to a bug in the firmware version running on the power
// supply. Capture that data into the error as well.
@@ -1082,8 +1083,8 @@
psu->getInputVoltage(actualInputVoltage, inputVoltage);
if (std::find(config.second.inputVoltage.begin(),
- config.second.inputVoltage.end(),
- inputVoltage) == config.second.inputVoltage.end())
+ config.second.inputVoltage.end(), inputVoltage) ==
+ config.second.inputVoltage.end())
{
tmpAdditionalData.clear();
tmpAdditionalData["ACTUAL_VOLTAGE"] =
@@ -1315,8 +1316,8 @@
namespace fs = std::filesystem;
std::stringstream ss;
ss << std::hex << std::setw(4) << std::setfill('0') << i2caddr;
- std::string symLinkPath = deviceDirPath + std::to_string(i2cbus) + "-" +
- ss.str() + driverDirName;
+ std::string symLinkPath =
+ deviceDirPath + std::to_string(i2cbus) + "-" + ss.str() + driverDirName;
try
{
fs::path linkStrPath = fs::read_symlink(symLinkPath);
diff --git a/phosphor-power-supply/test/power_supply_tests.cpp b/phosphor-power-supply/test/power_supply_tests.cpp
index 7d2e4c9..ef1e7f3 100644
--- a/phosphor-power-supply/test/power_supply_tests.cpp
+++ b/phosphor-power-supply/test/power_supply_tests.cpp
@@ -175,9 +175,9 @@
// NOT using D-Bus inventory path for presence.
try
{
- auto psu = std::make_unique<PowerSupply>(bus, PSUInventoryPath, 3, 0x68,
- "ibm-cffps", PSUGPIOLineName,
- isPowerOn);
+ auto psu = std::make_unique<PowerSupply>(
+ bus, PSUInventoryPath, 3, 0x68, "ibm-cffps", PSUGPIOLineName,
+ isPowerOn);
EXPECT_EQ(psu->isPresent(), false);
EXPECT_EQ(psu->isFaulted(), false);
diff --git a/phosphor-power-supply/util.cpp b/phosphor-power-supply/util.cpp
index d1253da..8fe4e23 100644
--- a/phosphor-power-supply/util.cpp
+++ b/phosphor-power-supply/util.cpp
@@ -23,8 +23,8 @@
}
catch (const std::exception& e)
{
- throw std::runtime_error(std::string("Failed to find line: ") +
- e.what());
+ throw std::runtime_error(
+ std::string("Failed to find line: ") + e.what());
}
}
@@ -92,9 +92,9 @@
try
{
- line.request(
- {__FUNCTION__, gpiod::line_request::DIRECTION_OUTPUT, flags},
- value);
+ line.request({__FUNCTION__, gpiod::line_request::DIRECTION_OUTPUT,
+ flags},
+ value);
line.release();
}
diff --git a/phosphor-power-supply/util.hpp b/phosphor-power-supply/util.hpp
index 293d44d..1614138 100644
--- a/phosphor-power-supply/util.hpp
+++ b/phosphor-power-supply/util.hpp
@@ -71,9 +71,9 @@
INVENTORY_OBJ_PATH, INVENTORY_MGR_IFACE, bus);
// Update inventory
- auto invMsg = bus.new_method_call(invService.c_str(),
- INVENTORY_OBJ_PATH,
- INVENTORY_MGR_IFACE, "Notify");
+ auto invMsg =
+ bus.new_method_call(invService.c_str(), INVENTORY_OBJ_PATH,
+ INVENTORY_MGR_IFACE, "Notify");
invMsg.append(std::move(invObj));
auto invMgrResponseMsg = bus.call(invMsg);
}
@@ -105,9 +105,9 @@
auto invService = phosphor::power::util::getService(
INVENTORY_OBJ_PATH, INVENTORY_MGR_IFACE, bus);
- auto invMsg = bus.new_method_call(invService.c_str(),
- INVENTORY_OBJ_PATH,
- INVENTORY_MGR_IFACE, "Notify");
+ auto invMsg =
+ bus.new_method_call(invService.c_str(), INVENTORY_OBJ_PATH,
+ INVENTORY_MGR_IFACE, "Notify");
invMsg.append(std::move(invObj));
auto invMgrResponseMsg = bus.call(invMsg);
}
diff --git a/phosphor-power-supply/util_base.hpp b/phosphor-power-supply/util_base.hpp
index b9d5e2e..6bbcb88 100644
--- a/phosphor-power-supply/util_base.hpp
+++ b/phosphor-power-supply/util_base.hpp
@@ -55,9 +55,8 @@
getUtils().setAvailable(bus, invpath, available);
}
-inline void handleChassisHealthRollup(sdbusplus::bus_t& bus,
- const std::string& invpath,
- bool addRollup)
+inline void handleChassisHealthRollup(
+ sdbusplus::bus_t& bus, const std::string& invpath, bool addRollup)
{
getUtils().handleChassisHealthRollup(bus, invpath, addRollup);
}