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/ADCSensor.cpp b/src/ADCSensor.cpp
index 0638b7d..a8287b4 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -54,11 +54,19 @@
maxVoltageReading / scaleFactor, minVoltageReading / scaleFactor,
conn, readState),
std::enable_shared_from_this<ADCSensor>(), objServer(objectServer),
- inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
- scaleFactor(scaleFactor),
+ inputDev(io), waitTimer(io), path(path), scaleFactor(scaleFactor),
sensorPollMs(static_cast<unsigned int>(pollRate * 1000)),
bridgeGpio(std::move(bridgeGpio)), thresholdTimer(io)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
+ int fd = open(path.c_str(), O_RDONLY);
+ if (fd < 0)
+ {
+ std::cerr << "unable to open acd device \n";
+ }
+
+ inputDev.assign(fd);
+
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/voltage/" + name,
"xyz.openbmc_project.Sensor.Value");
@@ -183,6 +191,8 @@
{
(*bridgeGpio).set(0);
}
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
int fd = open(path.c_str(), O_RDONLY);
if (fd < 0)
{