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/control/json/manager.cpp b/control/json/manager.cpp
index 0161304..6ae51c9 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -168,12 +168,12 @@
auto fans = getConfig<Fan>(false);
for (auto& fan : fans)
{
- configKey fanProfile = std::make_pair(fan.second->getZone(),
- fan.first.second);
- auto itZone = std::find_if(zones.begin(), zones.end(),
- [&fanProfile](const auto& zone) {
- return Manager::inConfig(fanProfile, zone.first);
- });
+ configKey fanProfile =
+ std::make_pair(fan.second->getZone(), fan.first.second);
+ auto itZone = std::find_if(
+ zones.begin(), zones.end(), [&fanProfile](const auto& zone) {
+ return Manager::inConfig(fanProfile, zone.first);
+ });
if (itZone != zones.end())
{
if (itZone->second->getTarget() != fan.second->getTarget() &&
@@ -273,19 +273,21 @@
{
// Profiles must have one match in the other's profiles(and they must be
// an active profile) to be used in the config
- return std::any_of(input.second.begin(), input.second.end(),
- [&comp](const auto& lProfile) {
- return std::any_of(comp.second.begin(), comp.second.end(),
- [&lProfile](const auto& rProfile) {
- if (lProfile != rProfile)
- {
- return false;
- }
- auto activeProfs = getActiveProfiles();
- return std::find(activeProfs.begin(), activeProfs.end(),
- lProfile) != activeProfs.end();
+ return std::any_of(
+ input.second.begin(), input.second.end(),
+ [&comp](const auto& lProfile) {
+ return std::any_of(
+ comp.second.begin(), comp.second.end(),
+ [&lProfile](const auto& rProfile) {
+ if (lProfile != rProfile)
+ {
+ return false;
+ }
+ auto activeProfs = getActiveProfiles();
+ return std::find(activeProfs.begin(), activeProfs.end(),
+ lProfile) != activeProfs.end();
+ });
});
- });
}
}
@@ -416,8 +418,8 @@
if (servIter != pathIter->second.end())
{
if (std::find(servIter->second.second.begin(),
- servIter->second.second.end(),
- intf) == servIter->second.second.end())
+ servIter->second.second.end(), intf) ==
+ servIter->second.second.end())
{
// Add interface to cache
servIter->second.second.emplace_back(intf);
@@ -427,8 +429,8 @@
{
// Service not found in cache
auto intfs = {intf};
- pathIter->second[itServ.first] = std::make_pair(true,
- intfs);
+ pathIter->second[itServ.first] =
+ std::make_pair(true, intfs);
}
}
}
@@ -458,8 +460,8 @@
return serviceName;
}
-std::vector<std::string> Manager::findPaths(const std::string& serv,
- const std::string& intf)
+std::vector<std::string>
+ Manager::findPaths(const std::string& serv, const std::string& intf)
{
std::vector<std::string> paths;
@@ -469,8 +471,8 @@
if (itServ != path.second.end())
{
if (std::find(itServ->second.second.begin(),
- itServ->second.second.end(),
- intf) != itServ->second.second.end())
+ itServ->second.second.end(), intf) !=
+ itServ->second.second.end())
{
if (std::find(paths.begin(), paths.end(), path.first) ==
paths.end())
@@ -598,9 +600,8 @@
}
}
-const std::optional<PropertyVariantType>
- Manager::getProperty(const std::string& path, const std::string& intf,
- const std::string& prop)
+const std::optional<PropertyVariantType> Manager::getProperty(
+ const std::string& path, const std::string& intf, const std::string& prop)
{
// TODO Objects hosted by fan control (i.e. ThermalMode) are required to
// update the cache upon being set/updated
@@ -691,11 +692,11 @@
// Look for the ObjectManager as an ancestor from the
// member.
- auto hasObjMgr = std::any_of(objMgrPaths.begin(),
- objMgrPaths.end(),
- [&member](const auto& path) {
- return member.find(path) != std::string::npos;
- });
+ auto hasObjMgr = std::any_of(
+ objMgrPaths.begin(), objMgrPaths.end(),
+ [&member](const auto& path) {
+ return member.find(path) != std::string::npos;
+ });
if (!hasObjMgr)
{
@@ -756,12 +757,12 @@
// Remove oneshot timers after they expired
if (data.first == TimerType::oneshot)
{
- auto itTimer = std::find_if(_timers.begin(), _timers.end(),
- [&data](const auto& timer) {
- return (data.first == timer.first->first &&
- (std::get<std::string>(data.second) ==
- std::get<std::string>(timer.first->second)));
- });
+ auto itTimer = std::find_if(
+ _timers.begin(), _timers.end(), [&data](const auto& timer) {
+ return (data.first == timer.first->first &&
+ (std::get<std::string>(data.second) ==
+ std::get<std::string>(timer.first->second)));
+ });
if (itTimer != std::end(_timers))
{
_timers.erase(itTimer);
@@ -776,8 +777,8 @@
{
// Handle the signal callback and only run the actions if the handler
// updated the cache for the given SignalObject
- if (std::get<SignalHandler>(pkg)(msg, std::get<SignalObject>(pkg),
- *this))
+ if (std::get<SignalHandler>(
+ pkg)(msg, std::get<SignalObject>(pkg), *this))
{
// Perform the actions in the handler package
auto& actions = std::get<TriggerActions>(pkg);
@@ -799,8 +800,8 @@
void Manager::setProfiles()
{
// Profiles JSON config file is optional
- auto confFile = fan::JsonConfig::getConfFile(confAppName,
- Profile::confFileName, true);
+ auto confFile =
+ fan::JsonConfig::getConfFile(confAppName, Profile::confFileName, true);
_profiles.clear();
if (!confFile.empty())
@@ -834,16 +835,16 @@
{
std::for_each(actions.begin(), actions.end(),
[&actList = it->second](auto& action) {
- actList.emplace_back(std::ref(action));
- });
+ actList.emplace_back(std::ref(action));
+ });
}
else
{
TriggerActions triggerActions;
std::for_each(actions.begin(), actions.end(),
[&triggerActions](auto& action) {
- triggerActions.emplace_back(std::ref(action));
- });
+ triggerActions.emplace_back(std::ref(action));
+ });
_parameterTriggers[name] = std::move(triggerActions);
}
}