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: I956cf3cb1bbfc017c4d4dceb3195c1d0735b0605
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/discrete_threshold.cpp b/src/discrete_threshold.cpp
index 9195878..0d98c28 100644
--- a/src/discrete_threshold.cpp
+++ b/src/discrete_threshold.cpp
@@ -12,8 +12,7 @@
Milliseconds dwellTimeIn, const std::string& thresholdValueIn,
const std::string& nameIn, const discrete::Severity severityIn,
std::unique_ptr<interfaces::Clock> clockIn) :
- ioc(ioc),
- triggerId(triggerIdIn), actions(std::move(actionsIn)),
+ ioc(ioc), triggerId(triggerIdIn), actions(std::move(actionsIn)),
dwellTime(dwellTimeIn), thresholdValue(thresholdValueIn),
numericThresholdValue(utils::stodStrict(thresholdValue)),
severity(severityIn), name(getNonEmptyName(nameIn)),
diff --git a/src/discrete_threshold.hpp b/src/discrete_threshold.hpp
index 3b0d101..1284461 100644
--- a/src/discrete_threshold.hpp
+++ b/src/discrete_threshold.hpp
@@ -56,8 +56,7 @@
ThresholdDetail(const std::string& sensorNameIn,
boost::asio::io_context& ioc) :
- timer(ioc),
- sensorName(sensorNameIn)
+ timer(ioc), sensorName(sensorNameIn)
{}
ThresholdDetail(const ThresholdDetail&) = delete;
ThresholdDetail(ThresholdDetail&&) = delete;
diff --git a/src/interfaces/sensor.hpp b/src/interfaces/sensor.hpp
index 7764b37..78a762e 100644
--- a/src/interfaces/sensor.hpp
+++ b/src/interfaces/sensor.hpp
@@ -21,9 +21,7 @@
struct Id
{
Id(std::string_view type, std::string_view service,
- std::string_view path) :
- type(type),
- service(service), path(path)
+ std::string_view path) : type(type), service(service), path(path)
{}
std::string type;
diff --git a/src/metric.cpp b/src/metric.cpp
index 2504dbf..c1c5fd2 100644
--- a/src/metric.cpp
+++ b/src/metric.cpp
@@ -14,9 +14,8 @@
CollectionTimeScope timeScopeIn,
CollectionDuration collectionDurationIn,
std::unique_ptr<interfaces::Clock> clockIn) :
- sensors(std::move(sensorsIn)),
- operationType(operationTypeIn), collectionTimeScope(timeScopeIn),
- collectionDuration(collectionDurationIn),
+ sensors(std::move(sensorsIn)), operationType(operationTypeIn),
+ collectionTimeScope(timeScopeIn), collectionDuration(collectionDurationIn),
collectionAlgorithms(
metrics::makeCollectionData(sensors.size(), operationType,
collectionTimeScope, collectionDuration)),
diff --git a/src/metric_value.hpp b/src/metric_value.hpp
index 5e7c6df..cbf259b 100644
--- a/src/metric_value.hpp
+++ b/src/metric_value.hpp
@@ -11,7 +11,6 @@
MetricValue(std::string_view metadataIn, double valueIn,
uint64_t timestampIn) :
- metadata(metadataIn),
- value(valueIn), timestamp(timestampIn)
+ metadata(metadataIn), value(valueIn), timestamp(timestampIn)
{}
};
diff --git a/src/metrics/collection_data.cpp b/src/metrics/collection_data.cpp
index 3610cba..915f570 100644
--- a/src/metrics/collection_data.cpp
+++ b/src/metrics/collection_data.cpp
@@ -35,8 +35,7 @@
public:
DataInterval(std::shared_ptr<CollectionFunction> function,
CollectionDuration duration) :
- function(std::move(function)),
- duration(duration)
+ function(std::move(function)), duration(duration)
{
if (duration.t.count() == 0)
{
diff --git a/src/numeric_threshold.cpp b/src/numeric_threshold.cpp
index 5980e23..2a02a92 100644
--- a/src/numeric_threshold.cpp
+++ b/src/numeric_threshold.cpp
@@ -9,8 +9,7 @@
Milliseconds dwellTimeIn, numeric::Direction directionIn,
double thresholdValueIn, numeric::Type typeIn,
std::unique_ptr<interfaces::Clock> clockIn) :
- ioc(ioc),
- triggerId(triggerIdIn), actions(std::move(actionsIn)),
+ ioc(ioc), triggerId(triggerIdIn), actions(std::move(actionsIn)),
dwellTime(dwellTimeIn), direction(directionIn),
thresholdValue(thresholdValueIn), type(typeIn), clock(std::move(clockIn))
{
diff --git a/src/numeric_threshold.hpp b/src/numeric_threshold.hpp
index 4b861a3..5337624 100644
--- a/src/numeric_threshold.hpp
+++ b/src/numeric_threshold.hpp
@@ -57,8 +57,7 @@
ThresholdDetail(const std::string& sensorNameIn,
boost::asio::io_context& ioc) :
- timer(ioc),
- sensorName(sensorNameIn)
+ timer(ioc), sensorName(sensorNameIn)
{}
ThresholdDetail(const ThresholdDetail&) = delete;
ThresholdDetail(ThresholdDetail&&) = delete;
diff --git a/src/on_change_threshold.cpp b/src/on_change_threshold.cpp
index 206deb2..b05f4a4 100644
--- a/src/on_change_threshold.cpp
+++ b/src/on_change_threshold.cpp
@@ -6,9 +6,8 @@
const std::string& triggerIdIn, Sensors sensorsIn,
std::vector<std::unique_ptr<interfaces::TriggerAction>> actionsIn,
std::unique_ptr<interfaces::Clock> clockIn) :
- triggerId(triggerIdIn),
- sensors(std::move(sensorsIn)), actions(std::move(actionsIn)),
- clock(std::move(clockIn))
+ triggerId(triggerIdIn), sensors(std::move(sensorsIn)),
+ actions(std::move(actionsIn)), clock(std::move(clockIn))
{}
void OnChangeThreshold::initialize()
diff --git a/src/report.cpp b/src/report.cpp
index c9df1e2..21302b4 100644
--- a/src/report.cpp
+++ b/src/report.cpp
@@ -31,8 +31,7 @@
const interfaces::ReportFactory& reportFactory,
const bool enabledIn, std::unique_ptr<interfaces::Clock> clock,
Readings readingsIn) :
- id(reportId),
- path(utils::pathAppend(utils::constants::reportDirPath, id)),
+ id(reportId), path(utils::pathAppend(utils::constants::reportDirPath, id)),
name(reportName), reportingType(reportingTypeIn), interval(intervalIn),
reportActions(reportActionsIn.begin(), reportActionsIn.end()),
metricCount(getMetricCount(metricsIn)), appendLimit(appendLimitIn),
@@ -203,8 +202,7 @@
persistency = storeConfiguration();
}
return 1;
- },
- [this](const auto&) { return state.get<ReportFlags::enabled>(); });
+ }, [this](const auto&) { return state.get<ReportFlags::enabled>(); });
dbusIface->register_method(
"SetReportingProperties",
[this](std::string newReportingType, uint64_t newInterval) {
@@ -276,8 +274,7 @@
persistency = oldVal = false;
}
return 1;
- },
- [this](const auto&) { return persistency; });
+ }, [this](const auto&) { return persistency; });
dbusIface->register_property_r("Readings", readings,
sdbusplus::vtable::property_::emits_change,
@@ -302,8 +299,7 @@
persistency = storeConfiguration();
oldVal = std::move(newVal);
return 1;
- },
- [this](const auto&) { return readingParameters; });
+ }, [this](const auto&) { return readingParameters; });
dbusIface->register_property_r<bool>("EmitsReadingsUpdate",
sdbusplus::vtable::property_::none,
[this](const auto&) {
@@ -334,8 +330,7 @@
oldVal = std::move(newVal);
}
return 1;
- },
- [this](const auto&) {
+ }, [this](const auto&) {
return utils::transform<std::vector>(reportActions,
[](const auto reportAction) {
return utils::enumToString(reportAction);
@@ -344,15 +339,13 @@
dbusIface->register_property_r<uint64_t>(
"AppendLimit", sdbusplus::vtable::property_::emits_change,
[this](const auto&) { return appendLimit; });
- dbusIface->register_property_rw(
- "ReportUpdates", std::string(),
- sdbusplus::vtable::property_::emits_change,
- [this](auto newVal, auto& oldVal) {
+ dbusIface->register_property_rw("ReportUpdates", std::string(),
+ sdbusplus::vtable::property_::emits_change,
+ [this](auto newVal, auto& oldVal) {
setReportUpdates(utils::toReportUpdates(newVal));
oldVal = newVal;
return 1;
- },
- [this](const auto&) { return utils::enumToString(reportUpdates); });
+ }, [this](const auto&) { return utils::enumToString(reportUpdates); });
dbusIface->register_property_r(
"Triggers", std::vector<sdbusplus::message::object_path>{},
sdbusplus::vtable::property_::emits_change, [this](const auto&) {
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index 2d7cd40..c798247 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -12,8 +12,7 @@
std::shared_ptr<sdbusplus::asio::connection> bus,
const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
SensorCache& sensorCache) :
- bus(std::move(bus)),
- objServer(objServer), sensorCache(sensorCache)
+ bus(std::move(bus)), objServer(objServer), sensorCache(sensorCache)
{}
std::unique_ptr<interfaces::Report> ReportFactory::make(
diff --git a/src/sensor.cpp b/src/sensor.cpp
index 048dc52..f6f232b 100644
--- a/src/sensor.cpp
+++ b/src/sensor.cpp
@@ -11,8 +11,8 @@
Sensor::Sensor(interfaces::Sensor::Id sensorId,
const std::string& sensorMetadata, boost::asio::io_context& ioc,
const std::shared_ptr<sdbusplus::asio::connection>& bus) :
- sensorId(std::move(sensorId)),
- sensorMetadata(sensorMetadata), ioc(ioc), bus(bus)
+ sensorId(std::move(sensorId)), sensorMetadata(sensorMetadata), ioc(ioc),
+ bus(bus)
{}
Sensor::Id Sensor::makeId(std::string_view service, std::string_view path)
diff --git a/src/trigger.cpp b/src/trigger.cpp
index b80afa7..ca6804c 100644
--- a/src/trigger.cpp
+++ b/src/trigger.cpp
@@ -66,8 +66,7 @@
persistent = false;
}
return 1;
- },
- [this](const auto&) { return persistent; });
+ }, [this](const auto&) { return persistent; });
dbusIface.register_property_rw(
"Thresholds", TriggerThresholdParams{},
@@ -81,8 +80,7 @@
newThresholdParams);
oldVal = std::move(newVal);
return 1;
- },
- [this](const auto&) {
+ }, [this](const auto&) {
return fromLabeledThresholdParam(getLabeledThresholds());
});
@@ -99,8 +97,7 @@
}
oldVal = std::move(newVal);
return 1;
- },
- [this](const auto&) {
+ }, [this](const auto&) {
return utils::fromLabeledSensorsInfo(getLabeledSensorInfo());
});
@@ -117,8 +114,7 @@
messages::Presence::Exist, *id, *reportIds});
oldVal = std::move(newVal);
return 1;
- },
- [this](const auto&) {
+ }, [this](const auto&) {
return utils::transform<std::vector>(*reportIds,
[](const auto& id) {
return utils::pathAppend(utils::constants::reportDirPath, id);
@@ -138,8 +134,7 @@
}
name = oldVal = newVal;
return 1;
- },
- [this](const auto&) { return name; });
+ }, [this](const auto&) { return name; });
dbusIface.register_property_r(
"TriggerActions", std::vector<std::string>(),
diff --git a/src/trigger_actions.hpp b/src/trigger_actions.hpp
index 3e2c33c..83baca9 100644
--- a/src/trigger_actions.hpp
+++ b/src/trigger_actions.hpp
@@ -136,8 +136,7 @@
public:
UpdateReport(boost::asio::io_context& ioc,
std::shared_ptr<std::vector<std::string>> ids) :
- ioc(ioc),
- reportIds(std::move(ids))
+ ioc(ioc), reportIds(std::move(ids))
{}
void commit(const std::string& triggerId, const ThresholdName thresholdName,
diff --git a/src/trigger_factory.cpp b/src/trigger_factory.cpp
index 9f91b77..22b7ea5 100644
--- a/src/trigger_factory.cpp
+++ b/src/trigger_factory.cpp
@@ -16,8 +16,8 @@
std::shared_ptr<sdbusplus::asio::connection> bus,
std::shared_ptr<sdbusplus::asio::object_server> objServer,
SensorCache& sensorCache) :
- bus(std::move(bus)),
- objServer(std::move(objServer)), sensorCache(sensorCache)
+ bus(std::move(bus)), objServer(std::move(objServer)),
+ sensorCache(sensorCache)
{}
void TriggerFactory::updateDiscreteThresholds(
diff --git a/src/utils/labeled_tuple.hpp b/src/utils/labeled_tuple.hpp
index c519dd4..062b908 100644
--- a/src/utils/labeled_tuple.hpp
+++ b/src/utils/labeled_tuple.hpp
@@ -205,13 +205,11 @@
bool operator==(const LabeledTuple& other) const
{
- return std::apply(
- [&](auto&&... x) {
- return std::apply(
- [&](auto&&... y) { return (true && ... && detail::eq(x, y)); },
- value);
- },
- other.value);
+ return std::apply([&](auto&&... x) {
+ return std::apply([&](auto&&... y) {
+ return (true && ... && detail::eq(x, y));
+ }, value);
+ }, other.value);
}
bool operator<(const LabeledTuple& other) const
diff --git a/tests/src/dbus_environment.cpp b/tests/src/dbus_environment.cpp
index a0f454e..dd00d94 100644
--- a/tests/src/dbus_environment.cpp
+++ b/tests/src/dbus_environment.cpp
@@ -77,9 +77,9 @@
Milliseconds timeout)
{
auto& data = futures[std::string(name)];
- auto ret = waitForFutures(
- std::move(data), true, [](auto sum, auto val) { return sum && val; },
- timeout);
+ auto ret = waitForFutures(std::move(data), true, [](auto sum, auto val) {
+ return sum && val;
+ }, timeout);
data = std::vector<std::future<bool>>{};
return ret;
}
diff --git a/tests/src/dbus_environment.hpp b/tests/src/dbus_environment.hpp
index f3f7723..21191ae 100644
--- a/tests/src/dbus_environment.hpp
+++ b/tests/src/dbus_environment.hpp
@@ -82,9 +82,9 @@
std::vector<std::future<T>> futures;
futures.emplace_back(std::move(future));
- return waitForFutures(
- std::move(futures), T{},
- [](auto, const auto& value) { return value; }, timeout);
+ return waitForFutures(std::move(futures), T{},
+ [](auto, const auto& value) { return value; },
+ timeout);
}
static bool waitForFuture(std::string_view name,
diff --git a/tests/src/stubs/dbus_sensor_object.cpp b/tests/src/stubs/dbus_sensor_object.cpp
index dbe95ca..224e1de 100644
--- a/tests/src/stubs/dbus_sensor_object.cpp
+++ b/tests/src/stubs/dbus_sensor_object.cpp
@@ -14,8 +14,7 @@
boost::asio::io_context& ioc,
const std::shared_ptr<sdbusplus::asio::connection>& bus,
const std::shared_ptr<sdbusplus::asio::object_server>& objServer) :
- ioc(ioc),
- bus(bus), objServer(objServer)
+ ioc(ioc), bus(bus), objServer(objServer)
{
sensorIface = objServer->add_unique_interface(path(), interface(),
[this](auto& iface) {
diff --git a/tests/src/test_discrete_threshold.cpp b/tests/src/test_discrete_threshold.cpp
index 43a36c0..36d3a29 100644
--- a/tests/src/test_discrete_threshold.cpp
+++ b/tests/src/test_discrete_threshold.cpp
@@ -135,8 +135,7 @@
UpdateParams(size_t sensor, double value,
Milliseconds sleepAfter = 0ms) :
- sensor(sensor),
- value(value), sleepAfter(sleepAfter)
+ sensor(sensor), value(value), sleepAfter(sleepAfter)
{}
};
@@ -148,8 +147,7 @@
ExpectedParams(size_t sensor, double value,
Milliseconds waitMin = 0ms) :
- sensor(sensor),
- value(value), waitMin(waitMin)
+ sensor(sensor), value(value), waitMin(waitMin)
{}
};
diff --git a/tests/src/test_numeric_threshold.cpp b/tests/src/test_numeric_threshold.cpp
index a71f003..587a1bb 100644
--- a/tests/src/test_numeric_threshold.cpp
+++ b/tests/src/test_numeric_threshold.cpp
@@ -89,8 +89,7 @@
UpdateParams(size_t sensor, double value,
Milliseconds sleepAfter = 0ms) :
- sensor(sensor),
- value(value), sleepAfter(sleepAfter)
+ sensor(sensor), value(value), sleepAfter(sleepAfter)
{}
};
@@ -102,8 +101,7 @@
ExpectedParams(size_t sensor, double value,
Milliseconds waitMin = 0ms) :
- sensor(sensor),
- value(value), waitMin(waitMin)
+ sensor(sensor), value(value), waitMin(waitMin)
{}
};
diff --git a/tests/src/test_report.cpp b/tests/src/test_report.cpp
index e4e5510..709efdd 100644
--- a/tests/src/test_report.cpp
+++ b/tests/src/test_report.cpp
@@ -199,8 +199,7 @@
DbusEnvironment::getBus()->async_method_call(
[&methodPromise](boost::system::error_code ec) {
methodPromise.set_value(ec);
- },
- DbusEnvironment::serviceName(), path, interface, method);
+ }, DbusEnvironment::serviceName(), path, interface, method);
return DbusEnvironment::waitForFuture(methodPromise.get_future());
}
@@ -642,8 +641,8 @@
std::make_pair("ReportActions", nlohmann::json(utils::transform(
defaultParams().reportActions(),
[](const auto v) {
- return utils::toUnderlying(v);
-}))),
+ return utils::toUnderlying(v);
+ }))),
std::make_pair("Interval",
nlohmann::json(defaultParams().interval().count())),
std::make_pair("AppendLimit",
diff --git a/tests/src/test_trigger.cpp b/tests/src/test_trigger.cpp
index 3e5818a..cfe0e15 100644
--- a/tests/src/test_trigger.cpp
+++ b/tests/src/test_trigger.cpp
@@ -141,8 +141,7 @@
DbusEnvironment::getBus()->async_method_call(
[&methodPromise](boost::system::error_code ec) {
methodPromise.set_value(ec);
- },
- DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
+ }, DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
"Delete");
return DbusEnvironment::waitForFuture(methodPromise.get_future());
}