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/Thresholds.cpp b/src/Thresholds.cpp
index 42c634f..fc252ac 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -101,8 +101,8 @@
auto hysteresisFind = cfg.find("Hysteresis");
if (hysteresisFind != cfg.end())
{
- hysteresis = std::visit(VariantToDoubleVisitor(),
- hysteresisFind->second);
+ hysteresis =
+ std::visit(VariantToDoubleVisitor(), hysteresisFind->second);
}
auto directionFind = cfg.find("Direction");
@@ -115,11 +115,11 @@
<< intf << "\n";
return false;
}
- unsigned int severity = std::visit(VariantToUnsignedIntVisitor(),
- severityFind->second);
+ unsigned int severity =
+ std::visit(VariantToUnsignedIntVisitor(), severityFind->second);
- std::string directions = std::visit(VariantToStringVisitor(),
- directionFind->second);
+ std::string directions =
+ std::visit(VariantToStringVisitor(), directionFind->second);
Level level = findThresholdLevel(severity);
Direction direction = findThresholdDirection(directions);
@@ -142,64 +142,65 @@
{
for (size_t ii = 0; ii < thresholdCount; ii++)
{
- std::string thresholdInterface = baseInterface + ".Thresholds" +
- std::to_string(ii);
+ std::string thresholdInterface =
+ baseInterface + ".Thresholds" + std::to_string(ii);
conn->async_method_call(
[&, path, threshold, thresholdInterface,
labelMatch](const boost::system::error_code& ec,
const SensorBaseConfigMap& result) {
- if (ec)
- {
- return; // threshold not supported
- }
-
- if (!labelMatch.empty())
- {
- auto labelFind = result.find("Label");
- if (labelFind == result.end())
- {
- std::cerr << "No label in threshold configuration\n";
- return;
- }
- std::string label = std::visit(VariantToStringVisitor(),
- labelFind->second);
- if (label != labelMatch)
- {
- return;
- }
- }
-
- auto directionFind = result.find("Direction");
- auto severityFind = result.find("Severity");
- auto valueFind = result.find("Value");
- if (valueFind == result.end() || severityFind == result.end() ||
- directionFind == result.end())
- {
- std::cerr << "Malformed threshold in configuration\n";
- return;
- }
- unsigned int severity = std::visit(VariantToUnsignedIntVisitor(),
- severityFind->second);
-
- std::string dir = std::visit(VariantToStringVisitor(),
- directionFind->second);
- if ((findThresholdLevel(severity) != threshold.level) ||
- (findThresholdDirection(dir) != threshold.direction))
- {
- return; // not the droid we're looking for
- }
-
- std::variant<double> value(threshold.value);
- conn->async_method_call(
- [](const boost::system::error_code& ec) {
if (ec)
{
- std::cerr << "Error setting threshold " << ec << "\n";
+ return; // threshold not supported
}
+
+ if (!labelMatch.empty())
+ {
+ auto labelFind = result.find("Label");
+ if (labelFind == result.end())
+ {
+ std::cerr << "No label in threshold configuration\n";
+ return;
+ }
+ std::string label =
+ std::visit(VariantToStringVisitor(), labelFind->second);
+ if (label != labelMatch)
+ {
+ return;
+ }
+ }
+
+ auto directionFind = result.find("Direction");
+ auto severityFind = result.find("Severity");
+ auto valueFind = result.find("Value");
+ if (valueFind == result.end() || severityFind == result.end() ||
+ directionFind == result.end())
+ {
+ std::cerr << "Malformed threshold in configuration\n";
+ return;
+ }
+ unsigned int severity = std::visit(
+ VariantToUnsignedIntVisitor(), severityFind->second);
+
+ std::string dir =
+ std::visit(VariantToStringVisitor(), directionFind->second);
+ if ((findThresholdLevel(severity) != threshold.level) ||
+ (findThresholdDirection(dir) != threshold.direction))
+ {
+ return; // not the droid we're looking for
+ }
+
+ std::variant<double> value(threshold.value);
+ conn->async_method_call(
+ [](const boost::system::error_code& ec) {
+ if (ec)
+ {
+ std::cerr
+ << "Error setting threshold " << ec << "\n";
+ }
+ },
+ entityManagerName, path, "org.freedesktop.DBus.Properties",
+ "Set", thresholdInterface, "Value", value);
},
- entityManagerName, path, "org.freedesktop.DBus.Properties",
- "Set", thresholdInterface, "Value", value);
- },
entityManagerName, path, "org.freedesktop.DBus.Properties",
"GetAll", thresholdInterface);
}
@@ -217,8 +218,8 @@
continue;
}
- std::string property = Sensor::propertyLevel(threshold.level,
- threshold.direction);
+ std::string property =
+ Sensor::propertyLevel(threshold.level, threshold.direction);
if (property.empty())
{
continue;
@@ -292,10 +293,10 @@
thresholdChanges.emplace_back(threshold, true, value);
if (++cLoTrue < assertLogCount)
{
- std::cerr << "Sensor " << sensor->name << " low threshold "
- << threshold.value << " assert: value "
- << sensor->value << " raw data "
- << sensor->rawValue << "\n";
+ std::cerr
+ << "Sensor " << sensor->name << " low threshold "
+ << threshold.value << " assert: value " << sensor->value
+ << " raw data " << sensor->rawValue << "\n";
}
}
else if (value > (threshold.value + threshold.hysteresis))
@@ -514,8 +515,8 @@
for (const auto& t : map.at(item))
{
const auto& [suffix, level, direction, offset] = t;
- auto attrPath = boost::replace_all_copy(inputPath, item,
- suffix);
+ auto attrPath =
+ boost::replace_all_copy(inputPath, item, suffix);
if (auto val = readFile(attrPath, scaleFactor))
{
*val += offset;