clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: If66f68c96df4baf8dc07abf8729a3cb7657e932d
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 a6e4fae..4d7e8e8 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -9,7 +9,7 @@
#include <xyz/openbmc_project/Common/Device/error.hpp>
-#include <chrono> // sleep_for()
+#include <chrono> // sleep_for()
#include <cmath>
#include <cstdint> // uint8_t...
#include <fstream>
@@ -565,8 +565,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();
@@ -830,8 +830,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
{
@@ -919,8 +919,8 @@
sn = readVPDValue(SERIAL_NUMBER, Type::Debug, SERIAL_SIZE);
assetProps.emplace(SN_PROP, header + sn);
- fwVersion =
- readVPDValue(FW_VERSION, Type::HwmonDeviceDebug, VERSION_SIZE);
+ fwVersion = readVPDValue(FW_VERSION, Type::HwmonDeviceDebug,
+ VERSION_SIZE);
versionProps.emplace(VERSION_PROP, fwVersion);
ipzvpdVINIProps.emplace(
@@ -971,8 +971,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())
{
@@ -980,9 +980,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));
@@ -1009,8 +1009,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>(fmt::format("{} MFR_POUT_MAX read {}", shortName,
maxPowerOutStr)
.c_str());
@@ -1044,8 +1044,8 @@
std::string name{fmt::format("{}_input_power", shortName)};
- historyObjectPath =
- std::string{INPUT_HISTORY_SENSOR_ROOT} + '/' + name;
+ historyObjectPath = std::string{INPUT_HISTORY_SENSOR_ROOT} +
+ '/' + name;
// If the power supply was present, we created the
// recordManager. If it then went missing, the recordManager is
@@ -1060,8 +1060,8 @@
if (!average)
{
- auto avgPath =
- historyObjectPath + '/' + history::Average::name;
+ auto avgPath = historyObjectPath + '/' +
+ history::Average::name;
average = std::make_unique<history::Average>(bus, avgPath);
log<level::DEBUG>(
fmt::format("{} avgPath: {}", shortName, avgPath)
@@ -1070,8 +1070,8 @@
if (!maximum)
{
- auto maxPath =
- historyObjectPath + '/' + history::Maximum::name;
+ auto maxPath = historyObjectPath + '/' +
+ history::Maximum::name;
maximum = std::make_unique<history::Maximum>(bus, maxPath);
log<level::DEBUG>(
fmt::format("{} maxPath: {}", shortName, maxPath)
@@ -1113,9 +1113,9 @@
}
// Read just the most recent average/max record
- auto data =
- pmbusIntf->readBinary(INPUT_HISTORY, pmbus::Type::HwmonDeviceDebug,
- history::RecordManager::RAW_RECORD_SIZE);
+ auto data = pmbusIntf->readBinary(INPUT_HISTORY,
+ pmbus::Type::HwmonDeviceDebug,
+ history::RecordManager::RAW_RECORD_SIZE);
// Update D-Bus only if something changed (a new record ID, or cleared
// out)
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 5db6714..097cac6 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -824,7 +824,7 @@
*/
std::string findShortName(const std::string& invPath)
{
- auto const lastSlashPos = invPath.find_last_of('/');
+ const auto lastSlashPos = invPath.find_last_of('/');
if ((lastSlashPos == std::string::npos) ||
((lastSlashPos + 1) == invPath.size()))
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 5ad749c..d456ebf 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -168,8 +168,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);
}
@@ -233,10 +233,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
@@ -343,11 +343,10 @@
void PSUManager::getSystemProperties()
{
-
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");
@@ -518,8 +517,8 @@
{
additionalData["_PID"] = std::to_string(getpid());
- auto service =
- util::getService(loggingObjectPath, loggingCreateInterface, bus);
+ auto service = util::getService(loggingObjectPath,
+ loggingCreateInterface, bus);
if (service.empty())
{
@@ -569,10 +568,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();
@@ -616,8 +615,8 @@
// hexadecimal format.
additionalData["STATUS_WORD"] =
fmt::format("{:#04x}", psu->getStatusWord());
- additionalData["STATUS_MFR"] =
- fmt::format("{:#02x}", psu->getMFRFault());
+ additionalData["STATUS_MFR"] = fmt::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.
@@ -1301,8 +1300,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/mock.hpp b/phosphor-power-supply/test/mock.hpp
index d964964..6e2705e 100644
--- a/phosphor-power-supply/test/mock.hpp
+++ b/phosphor-power-supply/test/mock.hpp
@@ -15,7 +15,6 @@
{
class MockedPMBus : public PMBusBase
{
-
public:
virtual ~MockedPMBus() = default;
diff --git a/phosphor-power-supply/util.hpp b/phosphor-power-supply/util.hpp
index b09731a..b2b27f5 100644
--- a/phosphor-power-supply/util.hpp
+++ b/phosphor-power-supply/util.hpp
@@ -72,9 +72,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);
}
@@ -103,13 +103,12 @@
try
{
-
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);
}