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: Ib7af6345a7b9e858700bd81645fe87d9d7e9d0fb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/Utils.hpp b/src/Utils.hpp
index d76f954..78a6ecd 100644
--- a/src/Utils.hpp
+++ b/src/Utils.hpp
@@ -59,10 +59,9 @@
};
std::optional<std::string> openAndRead(const std::string& hwmonFile);
-std::optional<std::string>
- getFullHwmonFilePath(const std::string& directory,
- const std::string& hwmonBaseName,
- const std::set<std::string>& permitSet);
+std::optional<std::string> getFullHwmonFilePath(
+ const std::string& directory, const std::string& hwmonBaseName,
+ const std::set<std::string>& permitSet);
std::set<std::string> getPermitSet(const SensorBaseConfigMap& config);
bool findFiles(const std::filesystem::path& dirPath,
std::string_view matchString,
@@ -198,8 +197,8 @@
auto findPowerState = cfg.find("PowerState");
if (findPowerState != cfg.end())
{
- std::string powerState = std::visit(VariantToStringVisitor(),
- findPowerState->second);
+ std::string powerState =
+ std::visit(VariantToStringVisitor(), findPowerState->second);
setReadState(powerState, state);
}
return state;
@@ -225,11 +224,11 @@
{
conn->async_method_call(
[name](const boost::system::error_code ec) {
- if (ec)
- {
- std::cerr << "Failed to set LED " << name << "\n";
- }
- },
+ if (ec)
+ {
+ std::cerr << "Failed to set LED " << name << "\n";
+ }
+ },
"xyz.openbmc_project.LED.GroupManager",
"/xyz/openbmc_project/led/groups/" + name, properties::interface,
properties::set, "xyz.openbmc_project.Led.Group", "Asserted",
@@ -247,8 +246,7 @@
GetSensorConfiguration(
std::shared_ptr<sdbusplus::asio::connection> connection,
std::function<void(ManagedObjectType& resp)>&& callbackFunc) :
- dbusConnection(std::move(connection)),
- callback(std::move(callbackFunc))
+ dbusConnection(std::move(connection)), callback(std::move(callbackFunc))
{}
void getPath(const std::string& path, const std::string& interface,
@@ -263,31 +261,31 @@
self->dbusConnection->async_method_call(
[self, path, interface, owner, retries](
const boost::system::error_code ec, SensorBaseConfigMap& data) {
- if (ec)
- {
- std::cerr << "Error getting " << path << ": retries left"
- << retries - 1 << "\n";
- if (retries == 0U)
+ if (ec)
{
- return;
- }
- auto timer = std::make_shared<boost::asio::steady_timer>(
- self->dbusConnection->get_io_context());
- timer->expires_after(std::chrono::seconds(10));
- timer->async_wait([self, timer, path, interface, owner,
- retries](boost::system::error_code ec) {
- if (ec)
+ std::cerr << "Error getting " << path << ": retries left"
+ << retries - 1 << "\n";
+ if (retries == 0U)
{
- std::cerr << "Timer error!\n";
return;
}
- self->getPath(path, interface, owner, retries - 1);
- });
- return;
- }
+ auto timer = std::make_shared<boost::asio::steady_timer>(
+ self->dbusConnection->get_io_context());
+ timer->expires_after(std::chrono::seconds(10));
+ timer->async_wait([self, timer, path, interface, owner,
+ retries](boost::system::error_code ec) {
+ if (ec)
+ {
+ std::cerr << "Timer error!\n";
+ return;
+ }
+ self->getPath(path, interface, owner, retries - 1);
+ });
+ return;
+ }
- self->respData[path][interface] = std::move(data);
- },
+ self->respData[path][interface] = std::move(data);
+ },
owner, path, "org.freedesktop.DBus.Properties", "GetAll",
interface);
}
@@ -310,51 +308,52 @@
dbusConnection->async_method_call(
[self, interfaces, retries](const boost::system::error_code ec,
const GetSubTreeType& ret) {
- if (ec)
- {
- std::cerr << "Error calling mapper\n";
- if (retries == 0U)
+ if (ec)
{
- return;
- }
- auto timer = std::make_shared<boost::asio::steady_timer>(
- self->dbusConnection->get_io_context());
- timer->expires_after(std::chrono::seconds(10));
- timer->async_wait([self, timer, interfaces,
- retries](boost::system::error_code ec) {
- if (ec)
+ std::cerr << "Error calling mapper\n";
+ if (retries == 0U)
{
- std::cerr << "Timer error!\n";
return;
}
- self->getConfiguration(interfaces, retries - 1);
- });
+ auto timer = std::make_shared<boost::asio::steady_timer>(
+ self->dbusConnection->get_io_context());
+ timer->expires_after(std::chrono::seconds(10));
+ timer->async_wait([self, timer, interfaces,
+ retries](boost::system::error_code ec) {
+ if (ec)
+ {
+ std::cerr << "Timer error!\n";
+ return;
+ }
+ self->getConfiguration(interfaces, retries - 1);
+ });
- return;
- }
- for (const auto& [path, objDict] : ret)
- {
- if (objDict.empty())
- {
return;
}
- const std::string& owner = objDict.begin()->first;
-
- for (const std::string& interface : objDict.begin()->second)
+ for (const auto& [path, objDict] : ret)
{
- // anything that starts with a requested configuration
- // is good
- if (std::find_if(interfaces.begin(), interfaces.end(),
- [interface](const std::string& possible) {
- return interface.starts_with(possible);
- }) == interfaces.end())
+ if (objDict.empty())
{
- continue;
+ return;
}
- self->getPath(path, interface, owner);
+ const std::string& owner = objDict.begin()->first;
+
+ for (const std::string& interface : objDict.begin()->second)
+ {
+ // anything that starts with a requested configuration
+ // is good
+ if (std::find_if(
+ interfaces.begin(), interfaces.end(),
+ [interface](const std::string& possible) {
+ return interface.starts_with(possible);
+ }) == interfaces.end())
+ {
+ continue;
+ }
+ self->getPath(path, interface, owner);
+ }
}
- }
- },
+ },
mapper::busName, mapper::path, mapper::interface, mapper::subtree,
"/", 0, interfaces);
}