clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I0d10afa582342818b9d90b168f6f39f71ce4e0f4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
[AJ: regenerate using .clang-format from openbmc/docs@f44abd66eca8]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/.clang-format b/.clang-format
index 3a6c983..4922cf6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -36,12 +38,13 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
@@ -49,8 +52,8 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
-LambdaBodyIndentation: OuterScope
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
@@ -75,9 +78,14 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentExternBlock: NoIndent
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -85,13 +93,19 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
@@ -109,7 +123,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/src/ADCSensorMain.cpp b/src/ADCSensorMain.cpp
index 4987f1f..af4e0c2 100644
--- a/src/ADCSensorMain.cpp
+++ b/src/ADCSensorMain.cpp
@@ -201,8 +201,8 @@
auto findCPU = baseConfiguration->second.find("CPURequired");
if (findCPU != baseConfiguration->second.end())
{
- size_t index =
- std::visit(VariantToIntVisitor(), findCPU->second);
+ size_t index = std::visit(VariantToIntVisitor(),
+ findCPU->second);
auto presenceFind = cpuPresence.find(index);
if (presenceFind == cpuPresence.end())
{
@@ -239,8 +239,8 @@
}
}
- float pollRate =
- getPollRate(baseConfiguration->second, pollRateDefault);
+ float pollRate = getPollRate(baseConfiguration->second,
+ pollRateDefault);
PowerState readState = getPowerState(baseConfiguration->second);
auto& sensor = sensors[sensorName];
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 9beae58..0797bf0 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -67,7 +67,6 @@
const std::string& type,
std::function<void(const double&, sdbusplus::message_t&)>&& callback)
{
-
std::function<void(sdbusplus::message_t & message)> eventHandler =
[callback{std::move(callback)}](sdbusplus::message_t& message) {
std::string objectName;
@@ -192,7 +191,6 @@
void CFMSensor::setupMatches()
{
-
std::weak_ptr<CFMSensor> weakRef = weak_from_this();
setupSensorMatch(
matches, *dbusConnection, "fan_tach",
@@ -226,7 +224,6 @@
uint64_t maxRpm = 100;
if (!ec)
{
-
const auto* cfm = std::get_if<double>(&cfmVariant);
if (cfm != nullptr && *cfm >= minSystemCfm)
{
@@ -404,7 +401,6 @@
double totalCFM = 0;
for (const std::string& tachName : tachs)
{
-
auto findReading = std::find_if(
tachReadings.begin(), tachReadings.end(),
[&](const auto& item) { return item.first.ends_with(tachName); });
@@ -619,8 +615,8 @@
{
return;
}
- double reading =
- std::visit(VariantToDoubleVisitor(), value);
+ double reading = std::visit(VariantToDoubleVisitor(),
+ value);
if constexpr (debug)
{
std::cerr << cbPath << "Reading " << reading << "\n";
@@ -639,7 +635,6 @@
void ExitAirTempSensor::updateReading(void)
{
-
double val = 0.0;
if (calculate(val))
{
@@ -930,7 +925,6 @@
int main()
{
-
boost::asio::io_context io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
sdbusplus::asio::object_server objectServer(systemBus, true);
diff --git a/src/ExitAirTempSensor.hpp b/src/ExitAirTempSensor.hpp
index 5bd9735..bea8fba 100644
--- a/src/ExitAirTempSensor.hpp
+++ b/src/ExitAirTempSensor.hpp
@@ -50,7 +50,6 @@
public Sensor,
std::enable_shared_from_this<ExitAirTempSensor>
{
-
double powerFactorMin = 0.0;
double powerFactorMax = 0.0;
double qMin = 0.0;
diff --git a/src/ExternalSensor.cpp b/src/ExternalSensor.cpp
index cbba6e1..1717e49 100644
--- a/src/ExternalSensor.cpp
+++ b/src/ExternalSensor.cpp
@@ -55,8 +55,8 @@
objectServer.add_interface(objectPath, interface);
}
- association =
- objectServer.add_interface(objectPath, association::interface);
+ association = objectServer.add_interface(objectPath,
+ association::interface);
setInitialProperties(sensorUnits);
if constexpr (debug)
diff --git a/src/ExternalSensorMain.cpp b/src/ExternalSensorMain.cpp
index 2c10dc8..455df07 100644
--- a/src/ExternalSensorMain.cpp
+++ b/src/ExternalSensorMain.cpp
@@ -190,8 +190,8 @@
<< interfacePath << "\n";
continue;
}
- double minValue =
- std::visit(VariantToDoubleVisitor(), minFound->second);
+ double minValue = std::visit(VariantToDoubleVisitor(),
+ minFound->second);
if (!std::isfinite(minValue))
{
std::cerr << "MinValue parameter not parsed for "
@@ -206,8 +206,8 @@
<< interfacePath << "\n";
continue;
}
- double maxValue =
- std::visit(VariantToDoubleVisitor(), maxFound->second);
+ double maxValue = std::visit(VariantToDoubleVisitor(),
+ maxFound->second);
if (!std::isfinite(maxValue))
{
std::cerr << "MaxValue parameter not parsed for "
@@ -221,8 +221,8 @@
auto timeoutFound = baseConfigMap.find("Timeout");
if (timeoutFound != baseConfigMap.end())
{
- timeoutSecs =
- std::visit(VariantToDoubleVisitor(), timeoutFound->second);
+ timeoutSecs = std::visit(VariantToDoubleVisitor(),
+ timeoutFound->second);
}
if (!std::isfinite(timeoutSecs) || (timeoutSecs < 0.0))
{
@@ -242,8 +242,8 @@
<< "\n";
continue;
}
- sensorName =
- std::visit(VariantToStringVisitor(), nameFound->second);
+ sensorName = std::visit(VariantToStringVisitor(),
+ nameFound->second);
if (sensorName.empty())
{
std::cerr << "Name parameter not parsed for " << interfacePath
@@ -258,8 +258,8 @@
<< "\n";
continue;
}
- sensorUnits =
- std::visit(VariantToStringVisitor(), unitsFound->second);
+ sensorUnits = std::visit(VariantToStringVisitor(),
+ unitsFound->second);
if (sensorUnits.empty())
{
std::cerr << "Units parameter not parsed for " << interfacePath
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 85de747..9c8a738 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -209,7 +209,6 @@
const std::shared_ptr<sdbusplus::asio::connection>& conn,
sdbusplus::asio::object_server& objectServer)
{
-
conn->async_method_call(
[&objectServer, &sensors](boost::system::error_code& ec,
const ManagedObjectType& managedObj) {
@@ -485,8 +484,8 @@
continue;
}
- fs::path pwmEnableFile =
- "pwm" + std::to_string(pwm + 1) + "_enable";
+ fs::path pwmEnableFile = "pwm" + std::to_string(pwm + 1) +
+ "_enable";
fs::path enablePath = pwmPath.parent_path() / pwmEnableFile;
enablePwm(enablePath);
diff --git a/src/FileHandle.cpp b/src/FileHandle.cpp
index 227ce23..d36911c 100644
--- a/src/FileHandle.cpp
+++ b/src/FileHandle.cpp
@@ -21,7 +21,6 @@
FileHandle::FileHandle(FileHandle&& in) noexcept : fd(in.fd)
{
-
in.fd = -1;
}
diff --git a/src/FileHandle.hpp b/src/FileHandle.hpp
index a2a75d8..bcb774a 100644
--- a/src/FileHandle.hpp
+++ b/src/FileHandle.hpp
@@ -24,4 +24,4 @@
~FileHandle();
int handle() const;
-};
\ No newline at end of file
+};
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index 4c28345..40451e1 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -82,13 +82,13 @@
{
// offset is to default to 0 and scale to 1, see lore
// https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/
- struct SensorParams tmpSensorParameters = {.minValue = minValueTemperature,
- .maxValue = maxValueTemperature,
- .offsetValue = 0.0,
- .scaleValue = 1.0,
- .units =
- sensor_paths::unitDegreesC,
- .typeName = "temperature"};
+ struct SensorParams tmpSensorParameters = {
+ .minValue = minValueTemperature,
+ .maxValue = maxValueTemperature,
+ .offsetValue = 0.0,
+ .scaleValue = 1.0,
+ .units = sensor_paths::unitDegreesC,
+ .typeName = "temperature"};
// For IIO RAW sensors we get a raw_value, an offset, and scale
// to compute the value = (raw_value + offset) * scale
@@ -99,8 +99,8 @@
const std::string pathStr = path.string();
if (pathStr.ends_with("_raw"))
{
- std::string pathOffsetStr =
- pathStr.substr(0, pathStr.size() - 4) + "_offset";
+ std::string pathOffsetStr = pathStr.substr(0, pathStr.size() - 4) +
+ "_offset";
std::optional<double> tmpOffsetValue = readFile(pathOffsetStr, 1.0);
// In case there is nothing to read skip this device
// This is not an error condition see lore
@@ -110,8 +110,8 @@
tmpSensorParameters.offsetValue = *tmpOffsetValue;
}
- std::string pathScaleStr =
- pathStr.substr(0, pathStr.size() - 4) + "_scale";
+ std::string pathScaleStr = pathStr.substr(0, pathStr.size() - 4) +
+ "_scale";
std::optional<double> tmpScaleValue = readFile(pathScaleStr, 1.0);
// In case there is nothing to read skip this device
// This is not an error condition see lore
@@ -487,8 +487,8 @@
{
sensor = nullptr;
}
- auto hwmonFile =
- getFullHwmonFilePath(directory.string(), "temp1", permitSet);
+ auto hwmonFile = getFullHwmonFilePath(directory.string(), "temp1",
+ permitSet);
if (pathStr.starts_with("/sys/bus/iio/devices"))
{
hwmonFile = pathStr;
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 180c0c8..bd442f8 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -172,8 +172,8 @@
{
const char* bufEnd = readBuf.data() + bytesRead;
int nvalue = 0;
- std::from_chars_result ret =
- std::from_chars(readBuf.data(), bufEnd, nvalue);
+ std::from_chars_result ret = std::from_chars(readBuf.data(), bufEnd,
+ nvalue);
if (ret.ec != std::errc())
{
incrementError();
diff --git a/src/IntelCPUSensor.cpp b/src/IntelCPUSensor.cpp
index fa26332..2bebcd8 100644
--- a/src/IntelCPUSensor.cpp
+++ b/src/IntelCPUSensor.cpp
@@ -66,8 +66,8 @@
}
else
{
- interfacePath =
- "/xyz/openbmc_project/sensors/temperature/" + name;
+ interfacePath = "/xyz/openbmc_project/sensors/temperature/" +
+ name;
units = sensor_paths::unitDegreesC;
minValue = -128;
maxValue = 127;
@@ -192,8 +192,8 @@
{
const auto& [suffix, oldValue, dbusName] = vectorItem;
auto attrPath = boost::replace_all_copy(path, fileItem, suffix);
- if (auto newVal =
- readFile(attrPath, IntelCPUSensor::sensorScaleFactor))
+ if (auto newVal = readFile(attrPath,
+ IntelCPUSensor::sensorScaleFactor))
{
updateProperty(sensorInterface, oldValue, *newVal,
dbusName);
@@ -258,7 +258,6 @@
if (rdLen > 0)
{
-
try
{
rawValue = std::stod(response);
diff --git a/src/IntelCPUSensor.hpp b/src/IntelCPUSensor.hpp
index b23c0dc..0417c6e 100644
--- a/src/IntelCPUSensor.hpp
+++ b/src/IntelCPUSensor.hpp
@@ -70,8 +70,8 @@
{
return false;
}
- std::string gpioName =
- std::visit(VariantToStringVisitor(), findName->second);
+ std::string gpioName = std::visit(VariantToStringVisitor(),
+ findName->second);
auto findIndex = cpuPresence.find(gpioName);
if (findIndex != cpuPresence.end())
diff --git a/src/IntelCPUSensorMain.cpp b/src/IntelCPUSensorMain.cpp
index 011f2fb..9e48184 100644
--- a/src/IntelCPUSensorMain.cpp
+++ b/src/IntelCPUSensorMain.cpp
@@ -291,8 +291,8 @@
std::cerr << "could not determine CPU ID for " << hwmonName << "\n";
continue;
}
- int cpuId =
- std::visit(VariantToUnsignedIntVisitor(), findCpuId->second);
+ int cpuId = std::visit(VariantToUnsignedIntVisitor(),
+ findCpuId->second);
auto directory = hwmonNamePath.parent_path();
std::vector<fs::path> inputPaths;
@@ -313,8 +313,8 @@
}
auto& [type, nr, item] = *fileParts;
auto inputPathStr = inputPath.string();
- auto labelPath =
- boost::replace_all_copy(inputPathStr, item, "label");
+ auto labelPath = boost::replace_all_copy(inputPathStr, item,
+ "label");
std::ifstream labelFile(labelPath);
if (!labelFile.good())
{
@@ -672,10 +672,10 @@
{
continue;
}
- std::string nameRaw =
- std::visit(VariantToStringVisitor(), findName->second);
- std::string name =
- std::regex_replace(nameRaw, illegalDbusRegex, "_");
+ std::string nameRaw = std::visit(VariantToStringVisitor(),
+ findName->second);
+ std::string name = std::regex_replace(nameRaw, illegalDbusRegex,
+ "_");
auto present = std::optional<bool>();
// if we can't detect it via gpio, we set presence later
@@ -706,8 +706,8 @@
std::cerr << "Can't find 'Bus' setting in " << name << "\n";
continue;
}
- uint64_t bus =
- std::visit(VariantToUnsignedIntVisitor(), findBus->second);
+ uint64_t bus = std::visit(VariantToUnsignedIntVisitor(),
+ findBus->second);
auto findAddress = cfg.find("Address");
if (findAddress == cfg.end())
diff --git a/src/IntrusionSensorMain.cpp b/src/IntrusionSensorMain.cpp
index 362ffce..c2783b7 100644
--- a/src/IntrusionSensorMain.cpp
+++ b/src/IntrusionSensorMain.cpp
@@ -181,48 +181,48 @@
const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
{
auto getter = std::make_shared<GetSensorConfiguration>(
- dbusConnection, [](const ManagedObjectType& sensorConfigurations) {
- // Get NIC name and save to map
- lanInfoMap.clear();
- for (const auto& [path, cfgData] : sensorConfigurations)
+ dbusConnection,
+ [](const ManagedObjectType& sensorConfigurations) {
+ // Get NIC name and save to map
+ lanInfoMap.clear();
+ for (const auto& [path, cfgData] : sensorConfigurations)
+ {
+ const std::pair<std::string, SensorBaseConfigMap>*
+ baseConfiguration = nullptr;
+
+ // find base configuration
+ auto sensorBase = cfgData.find(configInterfaceName(nicType));
+ if (sensorBase == cfgData.end())
{
- const std::pair<std::string, SensorBaseConfigMap>*
- baseConfiguration = nullptr;
+ continue;
+ }
+ baseConfiguration = &(*sensorBase);
- // find base configuration
- auto sensorBase = cfgData.find(configInterfaceName(nicType));
- if (sensorBase == cfgData.end())
+ auto findEthIndex = baseConfiguration->second.find("EthIndex");
+ auto findName = baseConfiguration->second.find("Name");
+
+ if (findEthIndex != baseConfiguration->second.end() &&
+ findName != baseConfiguration->second.end())
+ {
+ const auto* pEthIndex =
+ std::get_if<uint64_t>(&findEthIndex->second);
+ const auto* pName = std::get_if<std::string>(&findName->second);
+ if (pEthIndex != nullptr && pName != nullptr)
{
- continue;
- }
- baseConfiguration = &(*sensorBase);
-
- auto findEthIndex = baseConfiguration->second.find("EthIndex");
- auto findName = baseConfiguration->second.find("Name");
-
- if (findEthIndex != baseConfiguration->second.end() &&
- findName != baseConfiguration->second.end())
- {
- const auto* pEthIndex =
- std::get_if<uint64_t>(&findEthIndex->second);
- const auto* pName =
- std::get_if<std::string>(&findName->second);
- if (pEthIndex != nullptr && pName != nullptr)
+ lanInfoMap[*pEthIndex] = *pName;
+ if (debugLanLeash)
{
- lanInfoMap[*pEthIndex] = *pName;
- if (debugLanLeash)
- {
- std::cout << "find name of eth" << *pEthIndex
- << " is " << *pName << "\n";
- }
+ std::cout << "find name of eth" << *pEthIndex << " is "
+ << *pName << "\n";
}
}
}
+ }
- if (lanInfoMap.empty())
- {
- std::cerr << "can't find matched NIC name. \n";
- }
+ if (lanInfoMap.empty())
+ {
+ std::cerr << "can't find matched NIC name. \n";
+ }
});
getter->getConfiguration(
@@ -306,8 +306,8 @@
{
std::string strEthNum = "eth" + std::to_string(ethNum) + lanInfo;
const auto* strState = newLanConnected ? "connected" : "lost";
- const auto* strMsgId =
- newLanConnected ? "OpenBMC.0.1.LanRegained" : "OpenBMC.0.1.LanLost";
+ const auto* strMsgId = newLanConnected ? "OpenBMC.0.1.LanRegained"
+ : "OpenBMC.0.1.LanLost";
lg2::info("{ETHDEV} LAN leash {STATE}", "ETHDEV", strEthNum, "STATE",
strState, "REDFISH_MESSAGE_ID", strMsgId,
@@ -393,9 +393,9 @@
std::cerr << "Unable to read lan status value\n";
return;
}
- bool isLanConnected =
- (*pState == "routable" || *pState == "carrier" ||
- *pState == "degraded");
+ bool isLanConnected = (*pState == "routable" ||
+ *pState == "carrier" ||
+ *pState == "degraded");
if (debugLanLeash)
{
std::cout << "ethNum = " << std::to_string(ethNum)
diff --git a/src/IpmbSDRSensor.cpp b/src/IpmbSDRSensor.cpp
index 73cfb43..d0ab884 100644
--- a/src/IpmbSDRSensor.cpp
+++ b/src/IpmbSDRSensor.cpp
@@ -65,8 +65,8 @@
constexpr uint8_t recordCountLSB = 1;
constexpr uint8_t recordCountMSB = 2;
- uint16_t recordCount =
- (data[recordCountMSB] << 8) | data[recordCountLSB];
+ uint16_t recordCount = (data[recordCountMSB] << 8) |
+ data[recordCountLSB];
self->reserveSDRRepository(recordCount);
},
@@ -225,8 +225,8 @@
int strLen = (sdrDataBytes[sdrtype01::nameLengthByte]) & (sdrLenBit);
/* iStrAddr represents the starting byte (Byte 56) for SDR sensor name */
- int strAddr =
- dataLen + ((dataLen / (sdr::perCountByte)) * 4) - (strLen - 1);
+ int strAddr = dataLen + ((dataLen / (sdr::perCountByte)) * 4) -
+ (strLen - 1);
/* Below for loop will convert the bytes to string and form a sensor name */
@@ -252,24 +252,24 @@
/* sdrSensCapability (Byte 13) and(&) with sdrThresAccess(0x0C) will declare
* whether threshold is present for each sensor */
- int threshold =
- (sdrDataBytes[sdrtype01::sensorCapability]) & (sdrThresAccess);
+ int threshold = (sdrDataBytes[sdrtype01::sensorCapability]) &
+ (sdrThresAccess);
/* mData - 10 bits
* mDataByte - Byte 28 - 8 bits LSB
* mTolDataByte - Byte 29 - 2 bits MSB [7-6]
*/
- uint16_t mData =
- ((sdrDataBytes[sdrtype01::mTolDataByte] & 0xC0) << bitShiftMsb) |
- sdrDataBytes[sdrtype01::mDataByte];
+ uint16_t mData = ((sdrDataBytes[sdrtype01::mTolDataByte] & 0xC0)
+ << bitShiftMsb) |
+ sdrDataBytes[sdrtype01::mDataByte];
/* bData - 10 bits
* bDataByte - Byte 30 - 8 bits LSB
* bAcuDataByte - Byte 31 - 2 bits MSB [7-6]
*/
- uint16_t bData =
- ((sdrDataBytes[sdrtype01::bAcuDataByte] & 0xC0) << bitShiftMsb) |
- sdrDataBytes[sdrtype01::bDataByte];
+ uint16_t bData = ((sdrDataBytes[sdrtype01::bAcuDataByte] & 0xC0)
+ << bitShiftMsb) |
+ sdrDataBytes[sdrtype01::bDataByte];
/* rbExpDataByte (Byte 33) represents the exponent value
* Bit [3-0] - B Exponent 2's complement signed bit.
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index 17ccbbb..51ccde1 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -267,7 +267,6 @@
bool IpmbSensor::processReading(const std::vector<uint8_t>& data, double& resp)
{
-
switch (readingFormat)
{
case (ReadingFormat::byte0):
@@ -550,8 +549,8 @@
}
uint8_t deviceAddress = loadVariant<uint8_t>(cfg, "Address");
- std::string sensorClass =
- loadVariant<std::string>(cfg, "Class");
+ std::string sensorClass = loadVariant<std::string>(cfg,
+ "Class");
uint8_t hostSMbusIndex = hostSMbusIndexDefault;
auto findSmType = cfg.find("HostSMbusIndex");
@@ -578,8 +577,8 @@
auto findType = cfg.find("SensorType");
if (findType != cfg.end())
{
- sensorTypeName =
- std::visit(VariantToStringVisitor(), findType->second);
+ sensorTypeName = std::visit(VariantToStringVisitor(),
+ findType->second);
}
auto& sensor = sensors[name];
@@ -702,7 +701,6 @@
int main()
{
-
boost::asio::io_context io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
sdbusplus::asio::object_server objectServer(systemBus, true);
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index dc7782c..e82c80f 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -228,8 +228,8 @@
uint8_t mcuAddress = loadVariant<uint8_t>(cfg, "Address");
uint8_t tempReg = loadVariant<uint8_t>(cfg, "Reg");
- std::string sensorClass =
- loadVariant<std::string>(cfg, "Class");
+ std::string sensorClass = loadVariant<std::string>(cfg,
+ "Class");
if constexpr (debug)
{
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index 9cd453e..9483a3d 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -151,10 +151,10 @@
}
const SensorBaseConfigMap& sensorConfig = sensorBase->second;
- std::optional<int> busNumber =
- extractBusNumber(interfacePath, sensorConfig);
- std::optional<std::string> sensorName =
- extractSensorName(interfacePath, sensorConfig);
+ std::optional<int> busNumber = extractBusNumber(interfacePath,
+ sensorConfig);
+ std::optional<std::string> sensorName = extractSensorName(interfacePath,
+ sensorConfig);
uint8_t slaveAddr = extractSlaveAddr(interfacePath, sensorConfig);
std::optional<int> rootBus = deriveRootBus(busNumber);
@@ -203,7 +203,6 @@
sdbusplus::asio::object_server& objectServer,
std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
{
-
auto getter = std::make_shared<GetSensorConfiguration>(
dbusConnection, [&io, &objectServer, &dbusConnection](
const ManagedObjectType& sensorConfigurations) {
diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp
index a827a44..053de6f 100644
--- a/src/PSUSensorMain.cpp
+++ b/src/PSUSensorMain.cpp
@@ -459,11 +459,11 @@
if (!firstScan)
{
std::string psuNameStr = "/" + escapeName(*psuName);
- auto it =
- std::find_if(sensorsChanged->begin(), sensorsChanged->end(),
- [psuNameStr](std::string& s) {
+ auto it = std::find_if(sensorsChanged->begin(),
+ sensorsChanged->end(),
+ [psuNameStr](std::string& s) {
return s.ends_with(psuNameStr);
- });
+ });
if (it == sensorsChanged->end())
{
@@ -544,12 +544,11 @@
size_t pos = sensorPathStr.find('_');
if (pos != std::string::npos)
{
-
std::string sensorPathStrMax = sensorPathStr.substr(pos);
if (sensorPathStrMax == "_max")
{
- labelPath =
- boost::replace_all_copy(sensorPathStr, "max", "label");
+ labelPath = boost::replace_all_copy(sensorPathStr, "max",
+ "label");
maxLabel = true;
}
else
@@ -872,8 +871,8 @@
{
// Sensor name not customized, do prefix/suffix composition,
// preserving default behavior by using psuNameFromIndex.
- sensorName =
- psuNameFromIndex + " " + psuProperty->labelTypeName;
+ sensorName = psuNameFromIndex + " " +
+ psuProperty->labelTypeName;
}
if constexpr (debug)
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index 3971324..41d625b 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -169,8 +169,8 @@
{
const char* bufEnd = readBuf.data() + bytesRead;
int nvalue = 0;
- std::from_chars_result ret =
- std::from_chars(readBuf.data(), bufEnd, nvalue);
+ std::from_chars_result ret = std::from_chars(readBuf.data(), bufEnd,
+ nvalue);
if (ret.ec != std::errc())
{
incrementError();
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index b751c67..d2811f3 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -93,8 +93,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");
@@ -107,11 +107,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);
@@ -134,8 +134,8 @@
{
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,
@@ -153,8 +153,8 @@
std::cerr << "No label in threshold configuration\n";
return;
}
- std::string label =
- std::visit(VariantToStringVisitor(), labelFind->second);
+ std::string label = std::visit(VariantToStringVisitor(),
+ labelFind->second);
if (label != labelMatch)
{
return;
@@ -170,11 +170,11 @@
std::cerr << "Malformed threshold in configuration\n";
return;
}
- unsigned int severity =
- std::visit(VariantToUnsignedIntVisitor(), severityFind->second);
+ unsigned int severity = std::visit(VariantToUnsignedIntVisitor(),
+ severityFind->second);
- std::string dir =
- std::visit(VariantToStringVisitor(), directionFind->second);
+ std::string dir = std::visit(VariantToStringVisitor(),
+ directionFind->second);
if ((findThresholdLevel(severity) != threshold.level) ||
(findThresholdDirection(dir) != threshold.direction))
{
@@ -209,8 +209,8 @@
continue;
}
- std::string property =
- Sensor::propertyLevel(threshold.level, threshold.direction);
+ std::string property = Sensor::propertyLevel(threshold.level,
+ threshold.direction);
if (property.empty())
{
continue;
@@ -506,8 +506,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;
diff --git a/src/Thresholds.hpp b/src/Thresholds.hpp
index a89c1dc..fa7ce0c 100644
--- a/src/Thresholds.hpp
+++ b/src/Thresholds.hpp
@@ -68,7 +68,6 @@
struct ThresholdTimer
{
-
explicit ThresholdTimer(boost::asio::io_context& ioService) : io(ioService)
{}
diff --git a/src/Utils.hpp b/src/Utils.hpp
index 444030c..0373563 100644
--- a/src/Utils.hpp
+++ b/src/Utils.hpp
@@ -180,7 +180,6 @@
inline void setReadState(const std::string& str, PowerState& val)
{
-
if (str == "On")
{
val = PowerState::on;
@@ -205,8 +204,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;
diff --git a/src/sensor.hpp b/src/sensor.hpp
index 434d81d..27bbd1a 100644
--- a/src/sensor.hpp
+++ b/src/sensor.hpp
@@ -288,17 +288,17 @@
continue;
}
- std::string level =
- propertyLevel(threshold.level, threshold.direction);
- std::string alarm =
- propertyAlarm(threshold.level, threshold.direction);
+ std::string level = propertyLevel(threshold.level,
+ threshold.direction);
+ std::string alarm = propertyAlarm(threshold.level,
+ threshold.direction);
if ((level.empty()) || (alarm.empty()))
{
continue;
}
- size_t thresSize =
- label.empty() ? thresholds.size() : thresholdSize;
+ size_t thresSize = label.empty() ? thresholds.size()
+ : thresholdSize;
iface->register_property(
level, threshold.value,
[&, label, thresSize](const double& request, double& oldValue) {
diff --git a/tests/test_Utils.cpp b/tests/test_Utils.cpp
index 2be1027..8a52699 100644
--- a/tests/test_Utils.cpp
+++ b/tests/test_Utils.cpp
@@ -49,8 +49,8 @@
void createPECIDir()
{
peciDir = fs::path(testDir) / "peci";
- auto peci0 =
- peciDir / "peci-0/device/0-30/peci-cputemp.0/hwmon/hwmon25";
+ auto peci0 = peciDir /
+ "peci-0/device/0-30/peci-cputemp.0/hwmon/hwmon25";
fs::create_directories(peci0);
{
std::ofstream temp0Input{peci0 / "temp0_input"};
@@ -108,9 +108,9 @@
TEST_F(TestUtils, findFiles_in_peci_no_match)
{
std::vector<fs::path> foundPaths;
- auto ret =
- findFiles(peciDir, R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/aaa$)",
- foundPaths, 6);
+ auto ret = findFiles(peciDir,
+ R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/aaa$)",
+ foundPaths, 6);
EXPECT_TRUE(ret);
EXPECT_TRUE(foundPaths.empty());
@@ -119,9 +119,9 @@
TEST_F(TestUtils, findFiles_in_peci_match)
{
std::vector<fs::path> foundPaths;
- auto ret =
- findFiles(peciDir, R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/name$)",
- foundPaths, 6);
+ auto ret = findFiles(peciDir,
+ R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/name$)",
+ foundPaths, 6);
EXPECT_TRUE(ret);
EXPECT_EQ(foundPaths.size(), 1U);
@@ -159,9 +159,9 @@
TEST_F(TestUtils, findFiles_in_sub_peci_match)
{
std::vector<fs::path> foundPaths;
- auto ret =
- findFiles(peciDir / "peci-0", R"(\d+-.+/peci-.+/hwmon/hwmon\d+/name$)",
- foundPaths, 5);
+ auto ret = findFiles(peciDir / "peci-0",
+ R"(\d+-.+/peci-.+/hwmon/hwmon\d+/name$)", foundPaths,
+ 5);
EXPECT_TRUE(ret);
EXPECT_EQ(foundPaths.size(), 1U);