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: Ica590f8613f1fb89ab1ca676ac51c1cc7e38d67f
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/presence/anyof.cpp b/presence/anyof.cpp
index 6b9403a..635e6a6 100644
--- a/presence/anyof.cpp
+++ b/presence/anyof.cpp
@@ -36,8 +36,8 @@
AnyOf::AnyOf(const Fan& fan,
const std::vector<std::reference_wrapper<PresenceSensor>>& s,
std::unique_ptr<EEPROMDevice> e) :
- RedundancyPolicy(fan, std::move(e)),
- state(), _powerState(getPowerStateObject()),
+ RedundancyPolicy(fan, std::move(e)), state(),
+ _powerState(getPowerStateObject()),
_powerOnDelayTimer(sdeventplus::Event::get_default(),
std::bind(&AnyOf::delayedAfterPowerOn, this)),
_powerOn(false)
@@ -62,10 +62,10 @@
void AnyOf::stateChanged(bool present, PresenceSensor& sensor)
{
// Find the sensor that changed state.
- auto sit = std::find_if(state.begin(), state.end(),
- [&sensor](const auto& s) {
- return std::get<sensorPos>(s).get() == sensor;
- });
+ auto sit =
+ std::find_if(state.begin(), state.end(), [&sensor](const auto& s) {
+ return std::get<sensorPos>(s).get() == sensor;
+ });
if (sit != state.end())
{
auto origState =
@@ -139,9 +139,10 @@
// If at least one, but not all, sensors indicate present, then
// tell the not present ones to log a conflict if not already done.
- if (std::any_of(
- state.begin(), state.end(),
- [this](const auto& s) { return std::get<presentPos>(s); }) &&
+ if (std::any_of(state.begin(), state.end(),
+ [this](const auto& s) {
+ return std::get<presentPos>(s);
+ }) &&
!std::all_of(state.begin(), state.end(),
[this](const auto& s) { return std::get<presentPos>(s); }))
{
diff --git a/presence/eeprom_device.hpp b/presence/eeprom_device.hpp
index 883cc17..a193471 100644
--- a/presence/eeprom_device.hpp
+++ b/presence/eeprom_device.hpp
@@ -41,8 +41,8 @@
*/
EEPROMDevice(const std::string& address, const std::string& driver,
size_t bindDelayInMS) :
- address(address),
- path(baseDriverPath / driver), bindDelay(bindDelayInMS),
+ address(address), path(baseDriverPath / driver),
+ bindDelay(bindDelayInMS),
timer(SDEventPlus::getEvent(),
std::bind(std::mem_fn(&EEPROMDevice::bindTimerExpired), this))
{}
diff --git a/presence/error_reporter.cpp b/presence/error_reporter.cpp
index b095717..927ca2f 100644
--- a/presence/error_reporter.cpp
+++ b/presence/error_reporter.cpp
@@ -47,8 +47,7 @@
sdbusplus::bus_t& bus,
const std::vector<
std::tuple<Fan, std::vector<std::unique_ptr<PresenceSensor>>>>& fans) :
- _bus(bus),
- _event(sdeventplus::Event::get_default()),
+ _bus(bus), _event(sdeventplus::Event::get_default()),
_powerState(getPowerStateObject())
{
_powerState->addCallback("errorReporter",
@@ -212,9 +211,10 @@
}
}
- std::for_each(
- _fanStates.begin(), _fanStates.end(),
- [this](const auto& fanState) { this->checkFan(fanState.first); });
+ std::for_each(_fanStates.begin(), _fanStates.end(),
+ [this](const auto& fanState) {
+ this->checkFan(fanState.first);
+ });
}
} // namespace phosphor::fan::presence
diff --git a/presence/error_reporter.hpp b/presence/error_reporter.hpp
index d6bc109..ef1111b 100644
--- a/presence/error_reporter.hpp
+++ b/presence/error_reporter.hpp
@@ -43,9 +43,8 @@
*/
ErrorReporter(
sdbusplus::bus_t& bus,
- const std::vector<
- std::tuple<Fan, std::vector<std::unique_ptr<PresenceSensor>>>>&
- fans);
+ const std::vector<std::tuple<
+ Fan, std::vector<std::unique_ptr<PresenceSensor>>>>& fans);
private:
/**
diff --git a/presence/fallback.cpp b/presence/fallback.cpp
index f301ac1..b3fc54a 100644
--- a/presence/fallback.cpp
+++ b/presence/fallback.cpp
@@ -79,8 +79,9 @@
{
// Find the first sensor that says the fan is present
// and set it as the active sensor.
- activeSensor = std::find_if(sensors.begin(), sensors.end(),
- [](auto& s) { return s.get().present(); });
+ activeSensor = std::find_if(sensors.begin(), sensors.end(), [](auto& s) {
+ return s.get().present();
+ });
if (activeSensor == sensors.end())
{
// The first sensor is working or all sensors
diff --git a/presence/fallback.hpp b/presence/fallback.hpp
index e6a1685..b9e2cbd 100644
--- a/presence/fallback.hpp
+++ b/presence/fallback.hpp
@@ -44,8 +44,7 @@
Fallback(const Fan& fan,
const std::vector<std::reference_wrapper<PresenceSensor>>& s,
std::unique_ptr<EEPROMDevice> e) :
- RedundancyPolicy(fan, std::move(e)),
- sensors(s)
+ RedundancyPolicy(fan, std::move(e)), sensors(s)
{
activeSensor = sensors.begin();
}
diff --git a/presence/gpio.cpp b/presence/gpio.cpp
index ceba1c6..0bd5b6f 100644
--- a/presence/gpio.cpp
+++ b/presence/gpio.cpp
@@ -41,8 +41,7 @@
Gpio::Gpio(const std::string& physDevice, const std::string& device,
unsigned int physPin) :
- currentState(false),
- evdevfd(open(device.c_str(), O_RDONLY | O_NONBLOCK)),
+ currentState(false), evdevfd(open(device.c_str(), O_RDONLY | O_NONBLOCK)),
evdev(evdevpp::evdev::newFromFD(evdevfd())), phys(physDevice), pin(physPin)
{}
diff --git a/presence/json_parser.cpp b/presence/json_parser.cpp
index ea1d496..d5705ef 100644
--- a/presence/json_parser.cpp
+++ b/presence/json_parser.cpp
@@ -190,14 +190,14 @@
eeprom["bind_delay_ms"].get<size_t>());
}
- auto fan = std::make_tuple(member["name"], member["path"],
- timeUntilError);
+ auto fan =
+ std::make_tuple(member["name"], member["path"], timeUntilError);
// Create a fan object
fans.emplace_back(std::make_tuple(fan, std::move(sensors)));
// Add fan presence policy
- auto policy = getPolicy(member["rpolicy"], fans.back(),
- std::move(eepromDevice));
+ auto policy =
+ getPolicy(member["rpolicy"], fans.back(), std::move(eepromDevice));
if (policy)
{
policies.emplace_back(std::move(policy));
@@ -213,9 +213,9 @@
// Create the error reporter class if necessary
if (std::any_of(_fans.begin(), _fans.end(), [](const auto& fan) {
- return std::get<std::optional<size_t>>(std::get<Fan>(fan)) !=
- std::nullopt;
- }))
+ return std::get<std::optional<size_t>>(std::get<Fan>(fan)) !=
+ std::nullopt;
+ }))
{
_reporter = std::make_unique<ErrorReporter>(_bus, _fans);
}
@@ -278,8 +278,8 @@
sensors.emplace_back(sensor.get<std::string>());
}
- return std::make_unique<PolicyAccess<Tach, JsonConfig>>(fanIndex,
- std::move(sensors));
+ return std::make_unique<PolicyAccess<Tach, JsonConfig>>(
+ fanIndex, std::move(sensors));
}
// Get a constructed presence sensor for fan presence detection by gpio
@@ -363,9 +363,8 @@
}
// Get a `Fallback` redundancy policy for the fan
-std::unique_ptr<RedundancyPolicy>
- getFallback(const fanPolicy& fan,
- std::unique_ptr<EEPROMDevice> eepromDevice)
+std::unique_ptr<RedundancyPolicy> getFallback(
+ const fanPolicy& fan, std::unique_ptr<EEPROMDevice> eepromDevice)
{
std::vector<std::reference_wrapper<PresenceSensor>> pSensors;
for (auto& fanSensor : std::get<fanPolicySensorListPos>(fan))
diff --git a/presence/json_parser.hpp b/presence/json_parser.hpp
index 9fe5645..1e23380 100644
--- a/presence/json_parser.hpp
+++ b/presence/json_parser.hpp
@@ -185,9 +185,8 @@
*
* @return - A `Fallback` redundancy policy
*/
-std::unique_ptr<RedundancyPolicy>
- getFallback(const fanPolicy& fan,
- std::unique_ptr<EEPROMDevice> eepromDevice);
+std::unique_ptr<RedundancyPolicy> getFallback(
+ const fanPolicy& fan, std::unique_ptr<EEPROMDevice> eepromDevice);
} // namespace rpolicy
diff --git a/presence/rpolicy.hpp b/presence/rpolicy.hpp
index e190029..259a31b 100644
--- a/presence/rpolicy.hpp
+++ b/presence/rpolicy.hpp
@@ -40,8 +40,7 @@
*/
explicit RedundancyPolicy(const Fan& f,
std::unique_ptr<EEPROMDevice> eeprom) :
- fan(f),
- eepromDevice(std::move(eeprom))
+ fan(f), eepromDevice(std::move(eeprom))
{}
/**
diff --git a/presence/tach.hpp b/presence/tach.hpp
index db8efa2..d45d595 100644
--- a/presence/tach.hpp
+++ b/presence/tach.hpp
@@ -90,9 +90,8 @@
* @param[in] sensor - The sensor that changed.
* @param[in] props - The properties that changed.
*/
- void
- propertiesChanged(size_t sensor,
- const phosphor::fan::util::Properties<double>& props);
+ void propertiesChanged(
+ size_t sensor, const phosphor::fan::util::Properties<double>& props);
/**
* @brief Properties changed handler for tach sensor updates.