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/TachSensor.cpp b/src/TachSensor.cpp
index d0051a0..f609410 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -53,10 +53,17 @@
objectType, false, false, limits.second, limits.first, conn,
powerState),
objServer(objectServer), redundancy(redundancy),
- presence(std::move(presenceSensor)),
- inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
- led(ledIn)
+ presence(std::move(presenceSensor)), inputDev(io), waitTimer(io),
+ path(path), led(ledIn)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
+ int fd = open(path.c_str(), O_RDONLY);
+ if (fd < 0)
+ {
+ std::cerr << "Tach sensor failed to open file\n";
+ }
+ inputDev.assign(fd);
+
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/fan_tach/" + name,
"xyz.openbmc_project.Sensor.Value");
@@ -162,6 +169,8 @@
}
responseStream.clear();
inputDev.close();
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
int fd = open(path.c_str(), O_RDONLY);
if (fd < 0)
{