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: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/redfish-core/lib/fan.hpp b/redfish-core/lib/fan.hpp
index 7245287..62494a8 100644
--- a/redfish-core/lib/fan.hpp
+++ b/redfish-core/lib/fan.hpp
@@ -65,19 +65,19 @@
[asyncResp, callback](
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse& subtreePaths) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR(
- "DBUS response error for getAssociatedSubTreePaths {}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR(
+ "DBUS response error for getAssociatedSubTreePaths {}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- callback(subtreePaths);
- });
+ callback(subtreePaths);
+ });
}
inline void doFanCollection(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -120,15 +120,16 @@
asyncResp, chassisId,
[asyncResp,
chassisId](const std::optional<std::string>& validChassisPath) {
- if (!validChassisPath)
- {
- messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
- return;
- }
- asyncResp->res.addHeader(
- boost::beast::http::field::link,
- "</redfish/v1/JsonSchemas/FanCollection/FanCollection.json>; rel=describedby");
- });
+ if (!validChassisPath)
+ {
+ messages::resourceNotFound(asyncResp->res, "Chassis",
+ chassisId);
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/FanCollection/FanCollection.json>; rel=describedby");
+ });
}
inline void
@@ -184,15 +185,15 @@
[fanPath, asyncResp,
callback](const boost::system::error_code& ec,
const dbus::utility::MapperGetObject& object) {
- if (ec || object.empty())
- {
- BMCWEB_LOG_ERROR("DBUS response error on getDbusObject {}",
- ec.value());
- messages::internalError(asyncResp->res);
- return;
- }
- callback(fanPath, object.begin()->first);
- });
+ if (ec || object.empty())
+ {
+ BMCWEB_LOG_ERROR("DBUS response error on getDbusObject {}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ callback(fanPath, object.begin()->first);
+ });
return;
}
@@ -210,8 +211,8 @@
asyncResp, validChassisPath,
[fanId, asyncResp, callback](
const dbus::utility::MapperGetSubTreePathsResponse& fanPaths) {
- handleFanPath(fanId, asyncResp, fanPaths, callback);
- });
+ handleFanPath(fanId, asyncResp, fanPaths, callback);
+ });
}
inline void addFanCommonProperties(crow::Response& resp,
@@ -236,23 +237,23 @@
*crow::connections::systemBus, service, fanPath,
"xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
[asyncResp](const boost::system::error_code& ec, const bool value) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for Health {}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- if (!value)
- {
- asyncResp->res.jsonValue["Status"]["Health"] =
- resource::Health::Critical;
- }
- });
+ if (!value)
+ {
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ resource::Health::Critical;
+ }
+ });
}
inline void getFanState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -262,23 +263,23 @@
*crow::connections::systemBus, service, fanPath,
"xyz.openbmc_project.Inventory.Item", "Present",
[asyncResp](const boost::system::error_code& ec, const bool value) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for State {}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for State {}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- if (!value)
- {
- asyncResp->res.jsonValue["Status"]["State"] =
- resource::State::Absent;
- }
- });
+ if (!value)
+ {
+ asyncResp->res.jsonValue["Status"]["State"] =
+ resource::State::Absent;
+ }
+ });
}
inline void getFanAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -290,52 +291,53 @@
[fanPath, asyncResp{asyncResp}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& assetList) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- const std::string* manufacturer = nullptr;
- const std::string* model = nullptr;
- const std::string* partNumber = nullptr;
- const std::string* serialNumber = nullptr;
- const std::string* sparePartNumber = nullptr;
+ const std::string* manufacturer = nullptr;
+ const std::string* model = nullptr;
+ const std::string* partNumber = nullptr;
+ const std::string* serialNumber = nullptr;
+ const std::string* sparePartNumber = nullptr;
- const bool success = sdbusplus::unpackPropertiesNoThrow(
- dbus_utils::UnpackErrorPrinter(), assetList, "Manufacturer",
- manufacturer, "Model", model, "PartNumber", partNumber,
- "SerialNumber", serialNumber, "SparePartNumber", sparePartNumber);
- if (!success)
- {
- messages::internalError(asyncResp->res);
- return;
- }
- if (manufacturer != nullptr)
- {
- asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
- }
- if (model != nullptr)
- {
- asyncResp->res.jsonValue["Model"] = *model;
- }
- if (partNumber != nullptr)
- {
- asyncResp->res.jsonValue["PartNumber"] = *partNumber;
- }
- if (serialNumber != nullptr)
- {
- asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
- }
- if (sparePartNumber != nullptr && !sparePartNumber->empty())
- {
- asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
- }
- });
+ const bool success = sdbusplus::unpackPropertiesNoThrow(
+ dbus_utils::UnpackErrorPrinter(), assetList, "Manufacturer",
+ manufacturer, "Model", model, "PartNumber", partNumber,
+ "SerialNumber", serialNumber, "SparePartNumber",
+ sparePartNumber);
+ if (!success)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (manufacturer != nullptr)
+ {
+ asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
+ }
+ if (model != nullptr)
+ {
+ asyncResp->res.jsonValue["Model"] = *model;
+ }
+ if (partNumber != nullptr)
+ {
+ asyncResp->res.jsonValue["PartNumber"] = *partNumber;
+ }
+ if (serialNumber != nullptr)
+ {
+ asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
+ }
+ if (sparePartNumber != nullptr && !sparePartNumber->empty())
+ {
+ asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
+ }
+ });
}
inline void getFanLocation(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -347,19 +349,20 @@
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
[asyncResp](const boost::system::error_code& ec,
const std::string& property) {
- if (ec)
- {
- if (ec.value() != EBADR)
+ if (ec)
{
- BMCWEB_LOG_ERROR("DBUS response error for Location{}",
- ec.value());
- messages::internalError(asyncResp->res);
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error for Location{}",
+ ec.value());
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
- property;
- });
+ asyncResp->res
+ .jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
+ property;
+ });
}
inline void
@@ -403,18 +406,20 @@
asyncResp, chassisId,
[asyncResp, chassisId,
fanId](const std::optional<std::string>& validChassisPath) {
- if (!validChassisPath)
- {
- messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
- return;
- }
- getValidFanPath(asyncResp, *validChassisPath, fanId,
- [asyncResp](const std::string&, const std::string&) {
- asyncResp->res.addHeader(
- boost::beast::http::field::link,
- "</redfish/v1/JsonSchemas/Fan/Fan.json>; rel=describedby");
+ if (!validChassisPath)
+ {
+ messages::resourceNotFound(asyncResp->res, "Chassis",
+ chassisId);
+ return;
+ }
+ getValidFanPath(
+ asyncResp, *validChassisPath, fanId,
+ [asyncResp](const std::string&, const std::string&) {
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/Fan/Fan.json>; rel=describedby");
+ });
});
- });
}
inline void handleFanGet(App& app, const crow::Request& req,