Turn on a bunch of warnings
Turn on as many warnings as easily possible from:
https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100
Tested:
ipmitool sensor list still works
Change-Id: Ied8fa66de9fcd25e448f8048c4f8216b426b6f55
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/PwmSensor.cpp b/src/PwmSensor.cpp
index 6402ad0..d8a7a17 100644
--- a/src/PwmSensor.cpp
+++ b/src/PwmSensor.cpp
@@ -22,7 +22,6 @@
#include <sdbusplus/asio/object_server.hpp>
static constexpr size_t pwmMax = 255;
-static constexpr size_t pwmMin = 0;
PwmSensor::PwmSensor(const std::string& name, const std::string& sysPath,
sdbusplus::asio::object_server& objectServer,
@@ -36,7 +35,7 @@
"/xyz/openbmc_project/sensors/fan_pwm/" + name,
"xyz.openbmc_project.Sensor.Value");
uint32_t pwmValue = getValue(false);
- double fValue = 100.0 * (static_cast<float>(pwmValue) / pwmMax);
+ double fValue = 100.0 * (static_cast<double>(pwmValue) / pwmMax);
sensorInterface->register_property(
"Value", fValue,
[this](const double& req, double& resp) {
@@ -58,7 +57,7 @@
return 1;
},
[this](double& curVal) {
- float value = 100.0 * (static_cast<float>(getValue()) / pwmMax);
+ double value = 100.0 * (static_cast<double>(getValue()) / pwmMax);
if (curVal != value)
{
curVal = value;
@@ -78,7 +77,7 @@
controlInterface->register_property(
"Target", static_cast<uint64_t>(pwmValue),
[this](const uint64_t& req, uint64_t& resp) {
- if (req > pwmMax || req < pwmMin)
+ if (req > pwmMax)
{
throw std::runtime_error("Value out of range");
return -1;
@@ -149,7 +148,7 @@
uint32_t value = std::stoi(line);
return value;
}
- catch (std::invalid_argument)
+ catch (std::invalid_argument&)
{
std::cerr << "Error reading pwm at " << sysPath << "\n";
// throw if not initial read to be caught by dbus bindings