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: Iee5e9ffc9cdaefb7db5577a9c422c1e9646253f2
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 0c7c895..5b04661 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -165,7 +165,7 @@
*/
static constexpr auto str_short = "RAIL";
using type = std::tuple<std::decay_t<decltype("RAIL=%d")>, uint16_t>;
- explicit constexpr RAIL(uint16_t a) : _entry(entry("RAIL=%d", a)){};
+ explicit constexpr RAIL(uint16_t a) : _entry(entry("RAIL=%d", a)) {};
type _entry;
};
struct RAIL_NAME
@@ -179,7 +179,7 @@
using type =
std::tuple<std::decay_t<decltype("RAIL_NAME=%s")>, const char*>;
explicit constexpr RAIL_NAME(const char* a) :
- _entry(entry("RAIL_NAME=%s", a)){};
+ _entry(entry("RAIL_NAME=%s", a)) {};
type _entry;
};
struct RAW_STATUS
@@ -193,7 +193,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSequencerVoltageFault
@@ -243,7 +243,7 @@
static constexpr auto str_short = "INPUT_NUM";
using type = std::tuple<std::decay_t<decltype("INPUT_NUM=%d")>, uint16_t>;
explicit constexpr INPUT_NUM(uint16_t a) :
- _entry(entry("INPUT_NUM=%d", a)){};
+ _entry(entry("INPUT_NUM=%d", a)) {};
type _entry;
};
struct INPUT_NAME
@@ -257,7 +257,7 @@
using type =
std::tuple<std::decay_t<decltype("INPUT_NAME=%s")>, const char*>;
explicit constexpr INPUT_NAME(const char* a) :
- _entry(entry("INPUT_NAME=%s", a)){};
+ _entry(entry("INPUT_NAME=%s", a)) {};
type _entry;
};
struct RAW_STATUS
@@ -271,7 +271,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSequencerPGOODFault
@@ -322,7 +322,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSequencerFault
@@ -371,7 +371,7 @@
using type =
std::tuple<std::decay_t<decltype("CALLOUT_ERRNO=%d")>, int32_t>;
explicit constexpr CALLOUT_ERRNO(int32_t a) :
- _entry(entry("CALLOUT_ERRNO=%d", a)){};
+ _entry(entry("CALLOUT_ERRNO=%d", a)) {};
type _entry;
};
struct CALLOUT_DEVICE_PATH
@@ -385,7 +385,7 @@
using type = std::tuple<std::decay_t<decltype("CALLOUT_DEVICE_PATH=%s")>,
const char*>;
explicit constexpr CALLOUT_DEVICE_PATH(const char* a) :
- _entry(entry("CALLOUT_DEVICE_PATH=%s", a)){};
+ _entry(entry("CALLOUT_DEVICE_PATH=%s", a)) {};
type _entry;
};
} // namespace _Device
@@ -434,7 +434,7 @@
using type =
std::tuple<std::decay_t<decltype("CALLOUT_GPIO_NUM=%u")>, uint32_t>;
explicit constexpr CALLOUT_GPIO_NUM(uint32_t a) :
- _entry(entry("CALLOUT_GPIO_NUM=%u", a)){};
+ _entry(entry("CALLOUT_GPIO_NUM=%u", a)) {};
type _entry;
};
} // namespace _GPIO
@@ -486,7 +486,7 @@
using type =
std::tuple<std::decay_t<decltype("CALLOUT_IIC_BUS=%s")>, const char*>;
explicit constexpr CALLOUT_IIC_BUS(const char* a) :
- _entry(entry("CALLOUT_IIC_BUS=%s", a)){};
+ _entry(entry("CALLOUT_IIC_BUS=%s", a)) {};
type _entry;
};
struct CALLOUT_IIC_ADDR
@@ -500,7 +500,7 @@
using type =
std::tuple<std::decay_t<decltype("CALLOUT_IIC_ADDR=0x%hx")>, uint16_t>;
explicit constexpr CALLOUT_IIC_ADDR(uint16_t a) :
- _entry(entry("CALLOUT_IIC_ADDR=0x%hx", a)){};
+ _entry(entry("CALLOUT_IIC_ADDR=0x%hx", a)) {};
type _entry;
};
} // namespace _IIC
@@ -553,7 +553,7 @@
using type = std::tuple<std::decay_t<decltype("CALLOUT_INVENTORY_PATH=%s")>,
const char*>;
explicit constexpr CALLOUT_INVENTORY_PATH(const char* a) :
- _entry(entry("CALLOUT_INVENTORY_PATH=%s", a)){};
+ _entry(entry("CALLOUT_INVENTORY_PATH=%s", a)) {};
type _entry;
};
} // namespace _Inventory
@@ -603,7 +603,7 @@
std::tuple<std::decay_t<decltype("CALLOUT_IPMI_SENSOR_NUM=%u")>,
uint32_t>;
explicit constexpr CALLOUT_IPMI_SENSOR_NUM(uint32_t a) :
- _entry(entry("CALLOUT_IPMI_SENSOR_NUM=%u", a)){};
+ _entry(entry("CALLOUT_IPMI_SENSOR_NUM=%u", a)) {};
type _entry;
};
} // namespace _IPMISensor
@@ -652,7 +652,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSupplyInputFault
@@ -703,7 +703,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSupplyShouldBeOn
@@ -754,7 +754,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSupplyOutputOvercurrent
@@ -805,7 +805,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSupplyOutputOvervoltage
@@ -856,7 +856,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSupplyFanFault
@@ -907,7 +907,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _PowerSupplyTemperatureFault
@@ -958,7 +958,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _GPUPowerFault
@@ -1009,7 +1009,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _GPUOverTemp
@@ -1060,7 +1060,7 @@
using type =
std::tuple<std::decay_t<decltype("RAW_STATUS=%s")>, const char*>;
explicit constexpr RAW_STATUS(const char* a) :
- _entry(entry("RAW_STATUS=%s", a)){};
+ _entry(entry("RAW_STATUS=%s", a)) {};
type _entry;
};
} // namespace _MemoryPowerFault
diff --git a/pmbus.cpp b/pmbus.cpp
index d7e8fc2..aca2d49 100644
--- a/pmbus.cpp
+++ b/pmbus.cpp
@@ -243,8 +243,8 @@
{
std::vector<uint8_t> data(length, 0);
- auto bytes = fread(data.data(), sizeof(decltype(data[0])), length,
- file.get());
+ auto bytes =
+ fread(data.data(), sizeof(decltype(data[0])), length, file.get());
if (bytes != length)
{
diff --git a/pmbus.hpp b/pmbus.hpp
index cb244fd..3c40409 100644
--- a/pmbus.hpp
+++ b/pmbus.hpp
@@ -141,8 +141,7 @@
*/
PMBus(const std::string& path, const std::string& driverName,
size_t instance) :
- basePath(path),
- driverName(driverName), instance(instance)
+ basePath(path), driverName(driverName), instance(instance)
{
findHwmonDir();
}
diff --git a/power-sequencer/pgood_monitor.hpp b/power-sequencer/pgood_monitor.hpp
index 5575cbc..7da9b38 100644
--- a/power-sequencer/pgood_monitor.hpp
+++ b/power-sequencer/pgood_monitor.hpp
@@ -45,8 +45,7 @@
PGOODMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
sdbusplus::bus_t& b, const sdeventplus::Event& e,
std::chrono::milliseconds& t) :
- DeviceMonitor(std::move(d), e, t),
- bus(b)
+ DeviceMonitor(std::move(d), e, t), bus(b)
{}
/**
diff --git a/power-sequencer/runtime_monitor.hpp b/power-sequencer/runtime_monitor.hpp
index 78f2c1d..d96b5bc 100644
--- a/power-sequencer/runtime_monitor.hpp
+++ b/power-sequencer/runtime_monitor.hpp
@@ -51,10 +51,10 @@
RuntimeMonitor(std::unique_ptr<witherspoon::power::Device>&& d,
sdbusplus::bus_t& b, const sdeventplus::Event& e,
std::chrono::milliseconds& i) :
- DeviceMonitor(std::move(d), e, i),
- bus(b), match(bus, getMatchString(),
- std::bind(std::mem_fn(&RuntimeMonitor::onPowerLost), this,
- std::placeholders::_1))
+ DeviceMonitor(std::move(d), e, i), bus(b),
+ match(bus, getMatchString(),
+ std::bind(std::mem_fn(&RuntimeMonitor::onPowerLost), this,
+ std::placeholders::_1))
{}
/**
diff --git a/power-supply/main.cpp b/power-supply/main.cpp
index c0efdcc..0a6f965 100644
--- a/power-supply/main.cpp
+++ b/power-supply/main.cpp
@@ -121,16 +121,16 @@
}
std::string name{"ps" + instnum + "_input_power"};
- std::string basePath = std::string{INPUT_HISTORY_SENSOR_ROOT} + '/' +
- name;
+ std::string basePath =
+ std::string{INPUT_HISTORY_SENSOR_ROOT} + '/' + name;
psuDevice->enableHistory(basePath, numRecords, syncGPIOPath, gpioNum);
// Systemd object manager
sdbusplus::server::manager_t objManager{bus, basePath.c_str()};
- std::string busName = std::string{INPUT_HISTORY_BUSNAME_ROOT} + '.' +
- name;
+ std::string busName =
+ std::string{INPUT_HISTORY_BUSNAME_ROOT} + '.' + name;
bus.request_name(busName.c_str());
}
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index bbb8218..9354050 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -72,20 +72,19 @@
const std::string& objpath, const std::string& invpath,
sdbusplus::bus_t& bus, const sdeventplus::Event& e,
std::chrono::seconds& t, std::chrono::seconds& p) :
- Device(name, inst),
- monitorPath(objpath), pmbusIntf(objpath),
+ Device(name, inst), monitorPath(objpath), pmbusIntf(objpath),
inventoryPath(INVENTORY_OBJ_PATH + invpath), bus(bus), presentInterval(p),
presentTimer(e, std::bind([this]() {
- // The hwmon path may have changed.
- pmbusIntf.findHwmonDir();
- this->present = true;
+ // The hwmon path may have changed.
+ pmbusIntf.findHwmonDir();
+ this->present = true;
- // Sync the INPUT_HISTORY data for all PSs
- syncHistory();
+ // Sync the INPUT_HISTORY data for all PSs
+ syncHistory();
- // Update the inventory for the new device
- updateInventory();
-})),
+ // Update the inventory for the new device
+ updateInventory();
+ })),
powerOnInterval(t),
powerOnTimer(e, std::bind([this]() { this->powerOn = true; }))
{
@@ -610,8 +609,8 @@
return;
}
- auto logEntryService = util::getService(logEntries[0], LOGGING_IFACE,
- bus);
+ auto logEntryService =
+ util::getService(logEntries[0], LOGGING_IFACE, bus);
if (logEntryService.empty())
{
return;
@@ -714,8 +713,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())
{
@@ -775,10 +774,9 @@
}
}
-void PowerSupply::enableHistory(const std::string& objectPath,
- size_t numRecords,
- const std::string& syncGPIOPath,
- size_t syncGPIONum)
+void PowerSupply::enableHistory(
+ const std::string& objectPath, size_t numRecords,
+ const std::string& syncGPIOPath, size_t syncGPIONum)
{
historyObjectPath = objectPath;
syncGPIODevPath = syncGPIOPath;
@@ -803,9 +801,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)
auto changed = recordManager->add(data);