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: Id49ad73c860533f4658c909e86d6dc8e1423efb4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/perform_scan.cpp b/src/perform_scan.cpp
index c503d99..e787360 100644
--- a/src/perform_scan.cpp
+++ b/src/perform_scan.cpp
@@ -60,25 +60,26 @@
}
systemBus->async_method_call(
- [instance, scan, probeVector, retries](boost::system::error_code& errc,
- const DBusInterface& resp) {
- if (errc)
- {
- std::cerr << "error calling getall on " << instance.busName << " "
- << instance.path << " " << instance.interface << "\n";
+ [instance, scan, probeVector,
+ retries](boost::system::error_code& errc, const DBusInterface& resp) {
+ if (errc)
+ {
+ std::cerr << "error calling getall on " << instance.busName
+ << " " << instance.path << " "
+ << instance.interface << "\n";
- auto timer = std::make_shared<boost::asio::steady_timer>(io);
- timer->expires_after(std::chrono::seconds(2));
+ auto timer = std::make_shared<boost::asio::steady_timer>(io);
+ timer->expires_after(std::chrono::seconds(2));
- timer->async_wait([timer, instance, scan, probeVector,
- retries](const boost::system::error_code&) {
- getInterfaces(instance, probeVector, scan, retries - 1);
- });
- return;
- }
+ timer->async_wait([timer, instance, scan, probeVector,
+ retries](const boost::system::error_code&) {
+ getInterfaces(instance, probeVector, scan, retries - 1);
+ });
+ return;
+ }
- scan->dbusProbeObjects[instance.path][instance.interface] = resp;
- },
+ scan->dbusProbeObjects[instance.path][instance.interface] = resp;
+ },
instance.busName, instance.path, "org.freedesktop.DBus.Properties",
"GetAll", instance.interface);
@@ -103,8 +104,8 @@
std::function<void(sdbusplus::message_t & message)> eventHandler =
[&](sdbusplus::message_t&) {
- propertiesChangedCallback(systemConfiguration, objServer);
- };
+ propertiesChangedCallback(systemConfiguration, objServer);
+ };
sdbusplus::bus::match_t match(
static_cast<sdbusplus::bus_t&>(*systemBus),
@@ -165,35 +166,37 @@
[interfaces, probeVector{std::move(probeVector)}, scan,
retries](boost::system::error_code& ec,
const GetSubTreeType& interfaceSubtree) mutable {
- if (ec)
- {
- if (ec.value() == ENOENT)
+ if (ec)
{
- return; // wasn't found by mapper
- }
- std::cerr << "Error communicating to mapper.\n";
+ if (ec.value() == ENOENT)
+ {
+ return; // wasn't found by mapper
+ }
+ std::cerr << "Error communicating to mapper.\n";
- if (retries == 0U)
- {
- // if we can't communicate to the mapper something is very
- // wrong
- std::exit(EXIT_FAILURE);
+ if (retries == 0U)
+ {
+ // if we can't communicate to the mapper something is very
+ // wrong
+ std::exit(EXIT_FAILURE);
+ }
+
+ auto timer = std::make_shared<boost::asio::steady_timer>(io);
+ timer->expires_after(std::chrono::seconds(10));
+
+ timer->async_wait(
+ [timer, interfaces{std::move(interfaces)}, scan,
+ probeVector{std::move(probeVector)},
+ retries](const boost::system::error_code&) mutable {
+ findDbusObjects(std::move(probeVector),
+ std::move(interfaces), scan,
+ retries - 1);
+ });
+ return;
}
- auto timer = std::make_shared<boost::asio::steady_timer>(io);
- timer->expires_after(std::chrono::seconds(10));
-
- timer->async_wait([timer, interfaces{std::move(interfaces)}, scan,
- probeVector{std::move(probeVector)}, retries](
- const boost::system::error_code&) mutable {
- findDbusObjects(std::move(probeVector), std::move(interfaces),
- scan, retries - 1);
- });
- return;
- }
-
- processDbusObjects(probeVector, scan, interfaceSubtree);
- },
+ processDbusObjects(probeVector, scan, interfaceSubtree);
+ },
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", maxMapperDepth,
@@ -262,10 +265,9 @@
*findExposes = copy;
}
-static void recordDiscoveredIdentifiers(std::set<nlohmann::json>& usedNames,
- std::list<size_t>& indexes,
- const std::string& probeName,
- const nlohmann::json& record)
+static void recordDiscoveredIdentifiers(
+ std::set<nlohmann::json>& usedNames, std::list<size_t>& indexes,
+ const std::string& probeName, const nlohmann::json& record)
{
size_t indexIdx = probeName.find('$');
if (indexIdx == std::string::npos)
@@ -328,9 +330,8 @@
return false;
}
-static std::optional<std::vector<std::string>::iterator>
- findExposeActionRecord(std::vector<std::string>& matches,
- const nlohmann::json& record)
+static std::optional<std::vector<std::string>::iterator> findExposeActionRecord(
+ std::vector<std::string>& matches, const nlohmann::json& record)
{
const auto& name = (record)["Name"].get_ref<const std::string&>();
auto compare = [&name](const std::string& s) { return s == name; };
@@ -365,10 +366,9 @@
}
}
-static void applyConfigExposeActions(std::vector<std::string>& matches,
- nlohmann::json& expose,
- const std::string& propertyName,
- nlohmann::json& configExposes)
+static void applyConfigExposeActions(
+ std::vector<std::string>& matches, nlohmann::json& expose,
+ const std::string& propertyName, nlohmann::json& configExposes)
{
for (auto& exposedObject : configExposes)
{
@@ -382,10 +382,9 @@
}
}
-static void applyExposeActions(nlohmann::json& systemConfiguration,
- const std::string& recordName,
- nlohmann::json& expose,
- nlohmann::json::iterator& keyPair)
+static void applyExposeActions(
+ nlohmann::json& systemConfiguration, const std::string& recordName,
+ nlohmann::json& expose, nlohmann::json::iterator& keyPair)
{
bool isBind = boost::starts_with(keyPair.key(), "Bind");
bool isDisable = keyPair.key() == "DisableNode";
@@ -433,11 +432,10 @@
}
}
-static std::string generateDeviceName(const std::set<nlohmann::json>& usedNames,
- const DBusObject& dbusObject,
- size_t foundDeviceIdx,
- const std::string& nameTemplate,
- std::optional<std::string>& replaceStr)
+static std::string generateDeviceName(
+ const std::set<nlohmann::json>& usedNames, const DBusObject& dbusObject,
+ size_t foundDeviceIdx, const std::string& nameTemplate,
+ std::optional<std::string>& replaceStr)
{
nlohmann::json copyForName = {{"Name", nameTemplate}};
nlohmann::json::iterator copyIt = copyForName.begin();