Enable cppcoreguidelines-pro-type-vararg check
We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie62165b599a996f34893aa5a3f8d1f6e6cbaf903
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 09fb33f..6577739 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -52,11 +52,20 @@
false, thisSensorParameters.maxValue, thisSensorParameters.minValue,
conn, powerState),
std::enable_shared_from_this<HwmonTempSensor>(), objServer(objectServer),
- inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
+ inputDev(io), waitTimer(io), path(path),
offsetValue(thisSensorParameters.offsetValue),
scaleValue(thisSensorParameters.scaleValue),
sensorPollMs(static_cast<unsigned int>(pollRate * 1000))
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
+ int fd = open(path.c_str(), O_RDONLY);
+ if (fd < 0)
+ {
+ std::cerr << "HwmonTempSensor " << sensorName << " failed to open "
+ << path << "\n";
+ }
+ inputDev.assign(fd);
+
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/" + thisSensorParameters.typeName + "/" +
name,
@@ -164,6 +173,8 @@
responseStream.clear();
inputDev.close();
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
int fd = open(path.c_str(), O_RDONLY);
if (fd < 0)
{