Make dbus-sensors compile with clang-13
clang-13 finds a lot more warnings for unused variables than it used to,
and also picks up some warnings about errant std::moves that are in
place.
This commit fixes them.
Tested:
code compiles against clang-13
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I80864287b7131acfe936c4b28afaf34ababb3029
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 70b9e7a..0165ffc 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -203,27 +203,26 @@
{
std::weak_ptr<CFMSensor> weakRef = weak_from_this();
- setupSensorMatch(matches, *dbusConnection, "fan_tach",
- std::move([weakRef](const double& value,
- sdbusplus::message::message& message) {
- auto self = weakRef.lock();
- if (!self)
- {
- return;
- }
- self->tachReadings[message.get_path()] = value;
- if (self->tachRanges.find(message.get_path()) ==
- self->tachRanges.end())
- {
- // calls update reading after updating ranges
- self->addTachRanges(message.get_sender(),
- message.get_path());
- }
- else
- {
- self->updateReading();
- }
- }));
+ setupSensorMatch(
+ matches, *dbusConnection, "fan_tach",
+ [weakRef](const double& value, sdbusplus::message::message& message) {
+ auto self = weakRef.lock();
+ if (!self)
+ {
+ return;
+ }
+ self->tachReadings[message.get_path()] = value;
+ if (self->tachRanges.find(message.get_path()) ==
+ self->tachRanges.end())
+ {
+ // calls update reading after updating ranges
+ self->addTachRanges(message.get_sender(), message.get_path());
+ }
+ else
+ {
+ self->updateReading();
+ }
+ });
dbusConnection->async_method_call(
[weakRef](const boost::system::error_code ec,
@@ -883,9 +882,8 @@
return;
}
auto getter = std::make_shared<GetSensorConfiguration>(
- dbusConnection,
- std::move([&objectServer, &dbusConnection,
- &exitAirSensor](const ManagedObjectType& resp) {
+ dbusConnection, [&objectServer, &dbusConnection,
+ &exitAirSensor](const ManagedObjectType& resp) {
cfmSensors.clear();
for (const auto& pathPair : resp)
{
@@ -955,7 +953,7 @@
exitAirSensor->setupMatches();
exitAirSensor->updateReading();
}
- }));
+ });
getter->getConfiguration(
std::vector<std::string>(monitorIfaces.begin(), monitorIfaces.end()));
}