Add modernize-redundant-void-arg
Enable this check and fix the failures.
Change-Id: I89b13daf1161be40564367562bb9c8c0c459e1d0
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/.clang-tidy b/.clang-tidy
index d5699b1..da851c0 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -229,6 +229,7 @@
modernize-make-shared,
modernize-make-unique,
modernize-raw-string-literal,
+modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index cfa2147..d6dcdca 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -94,7 +94,7 @@
objServer.remove_interface(association);
}
-void ADCSensor::setupRead(void)
+void ADCSensor::setupRead()
{
std::shared_ptr<boost::asio::streambuf> buffer =
std::make_shared<boost::asio::streambuf>();
@@ -225,7 +225,7 @@
});
}
-void ADCSensor::checkThresholds(void)
+void ADCSensor::checkThresholds()
{
if (!readingStateGood())
{
diff --git a/src/ADCSensor.hpp b/src/ADCSensor.hpp
index 045a65e..81f630d 100644
--- a/src/ADCSensor.hpp
+++ b/src/ADCSensor.hpp
@@ -75,7 +75,7 @@
const std::string& sensorConfiguration,
std::optional<BridgeGpio>&& bridgeGpio);
~ADCSensor() override;
- void setupRead(void);
+ void setupRead();
private:
sdbusplus::asio::object_server& objServer;
@@ -88,5 +88,5 @@
std::optional<BridgeGpio> bridgeGpio;
thresholds::ThresholdTimer thresholdTimer;
void handleResponse(const boost::system::error_code& err);
- void checkThresholds(void) override;
+ void checkThresholds() override;
};
diff --git a/src/DeviceMgmt.cpp b/src/DeviceMgmt.cpp
index ffc0376..e8eb875 100644
--- a/src/DeviceMgmt.cpp
+++ b/src/DeviceMgmt.cpp
@@ -49,7 +49,7 @@
return name.str();
}
-bool I2CDeviceParams::devicePresent(void) const
+bool I2CDeviceParams::devicePresent() const
{
fs::path path = i2cBusPath(bus) / deviceDirName(bus, address);
@@ -63,7 +63,7 @@
return fs::exists(path, ec);
}
-bool I2CDeviceParams::deviceStatic(void) const
+bool I2CDeviceParams::deviceStatic() const
{
if (!devicePresent())
{
@@ -91,7 +91,7 @@
destroy();
}
-int I2CDevice::create(void) const
+int I2CDevice::create() const
{
// If it's already instantiated, there's nothing we need to do.
if (params.devicePresent())
@@ -126,7 +126,7 @@
return 0;
}
-int I2CDevice::destroy(void) const
+int I2CDevice::destroy() const
{
// No params.devicePresent() check on this like in create(), since it
// might be used to clean up after a device instantiation that was only
diff --git a/src/DeviceMgmt.hpp b/src/DeviceMgmt.hpp
index 5e469de..84ad8a0 100644
--- a/src/DeviceMgmt.hpp
+++ b/src/DeviceMgmt.hpp
@@ -34,8 +34,8 @@
uint64_t bus;
uint64_t address;
- bool devicePresent(void) const;
- bool deviceStatic(void) const;
+ bool devicePresent() const;
+ bool deviceStatic() const;
};
std::optional<I2CDeviceParams>
@@ -51,8 +51,8 @@
private:
I2CDeviceParams params;
- int create(void) const;
- int destroy(void) const;
+ int create() const;
+ int destroy() const;
};
// HACK: this declaration "should" live in Utils.hpp, but that leads to a
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 59180b5..f0c5c59 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -286,7 +286,7 @@
objServer.remove_interface(pwmLimitIface);
}
-void CFMSensor::createMaxCFMIface(void)
+void CFMSensor::createMaxCFMIface()
{
cfmLimitIface->register_property("Limit", c2 * maxCFM * tachs.size());
cfmLimitIface->initialize();
@@ -318,12 +318,12 @@
"xyz.openbmc_project.Sensor.Value");
}
-void CFMSensor::checkThresholds(void)
+void CFMSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
-void CFMSensor::updateReading(void)
+void CFMSensor::updateReading()
{
double val = 0.0;
if (calculate(val))
@@ -524,7 +524,7 @@
objServer.remove_interface(association);
}
-void ExitAirTempSensor::setupMatches(void)
+void ExitAirTempSensor::setupMatches()
{
constexpr const auto matchTypes{
std::to_array<const char*>({"power", inletTemperatureSensor})};
@@ -632,7 +632,7 @@
std::array<const char*, 1>{sensorValueInterface});
}
-void ExitAirTempSensor::updateReading(void)
+void ExitAirTempSensor::updateReading()
{
double val = 0.0;
if (calculate(val))
@@ -646,7 +646,7 @@
}
}
-double ExitAirTempSensor::getTotalCFM(void)
+double ExitAirTempSensor::getTotalCFM()
{
double sum = 0;
for (auto& sensor : cfmSensors)
@@ -825,7 +825,7 @@
return true;
}
-void ExitAirTempSensor::checkThresholds(void)
+void ExitAirTempSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
diff --git a/src/ExitAirTempSensor.hpp b/src/ExitAirTempSensor.hpp
index bea8fba..68952ab 100644
--- a/src/ExitAirTempSensor.hpp
+++ b/src/ExitAirTempSensor.hpp
@@ -29,11 +29,11 @@
~CFMSensor() override;
bool calculate(double& /*value*/);
- void updateReading(void);
- void setupMatches(void);
- void createMaxCFMIface(void);
+ void updateReading();
+ void setupMatches();
+ void createMaxCFMIface();
void addTachRanges(const std::string& serviceName, const std::string& path);
- void checkThresholds(void) override;
+ void checkThresholds() override;
uint64_t getMaxRpm(uint64_t cfmMax) const;
private:
@@ -65,9 +65,9 @@
std::vector<thresholds::Threshold>&& thresholdData);
~ExitAirTempSensor() override;
- void checkThresholds(void) override;
- void updateReading(void);
- void setupMatches(void);
+ void checkThresholds() override;
+ void updateReading();
+ void setupMatches();
private:
double lastReading = 0.0;
@@ -78,6 +78,6 @@
sdbusplus::asio::object_server& objServer;
std::chrono::time_point<std::chrono::steady_clock> lastTime;
- static double getTotalCFM(void);
+ static double getTotalCFM();
bool calculate(double& val);
};
diff --git a/src/ExternalSensor.cpp b/src/ExternalSensor.cpp
index 1717e49..9a7a690 100644
--- a/src/ExternalSensor.cpp
+++ b/src/ExternalSensor.cpp
@@ -114,12 +114,12 @@
}
}
-void ExternalSensor::checkThresholds(void)
+void ExternalSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
-bool ExternalSensor::isAliveAndPerishable(void) const
+bool ExternalSensor::isAliveAndPerishable() const
{
return (writeAlive && writePerishable);
}
@@ -151,7 +151,7 @@
writeAlive = true;
}
-void ExternalSensor::writeInvalidate(void)
+void ExternalSensor::writeInvalidate()
{
writeAlive = false;
@@ -182,7 +182,7 @@
return (writeTimeout - ageElapsed(now));
}
-void ExternalSensor::externalSetTrigger(void)
+void ExternalSensor::externalSetTrigger()
{
if constexpr (debug)
{
diff --git a/src/ExternalSensor.hpp b/src/ExternalSensor.hpp
index 20dd2f0..6f5b3db 100644
--- a/src/ExternalSensor.hpp
+++ b/src/ExternalSensor.hpp
@@ -31,7 +31,7 @@
writeHookIn);
// Returns true if sensor has external Value that is subject to timeout
- bool isAliveAndPerishable(void) const;
+ bool isAliveAndPerishable() const;
// Returns true if AliveAndPerishable and timeout has not yet happened
bool
@@ -41,7 +41,7 @@
void writeBegin(const std::chrono::steady_clock::time_point& now);
// Marks sensor as timed out, replacing Value with floating-point "NaN"
- void writeInvalidate(void);
+ void writeInvalidate();
// Returns amount of time elapsed since last writeBegin() happened
std::chrono::steady_clock::duration
@@ -61,6 +61,6 @@
std::function<void(const std::chrono::steady_clock::time_point& now)>
writeHook;
- void checkThresholds(void) override;
- void externalSetTrigger(void);
+ void checkThresholds() override;
+ void externalSetTrigger();
};
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index c7449d5..dd95c3b 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -117,7 +117,7 @@
objServer.remove_interface(association);
}
-void HwmonTempSensor::setupRead(void)
+void HwmonTempSensor::setupRead()
{
if (!readingStateGood())
{
@@ -191,7 +191,7 @@
restartRead();
}
-void HwmonTempSensor::checkThresholds(void)
+void HwmonTempSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
diff --git a/src/HwmonTempSensor.hpp b/src/HwmonTempSensor.hpp
index d45dafd..7208090 100644
--- a/src/HwmonTempSensor.hpp
+++ b/src/HwmonTempSensor.hpp
@@ -35,11 +35,11 @@
PowerState powerState,
const std::shared_ptr<I2CDevice>& i2cDevice);
~HwmonTempSensor() override;
- void setupRead(void);
+ void setupRead();
void activate(const std::string& newPath,
const std::shared_ptr<I2CDevice>& newI2CDevice);
- void deactivate(void);
- bool isActive(void);
+ void deactivate();
+ bool isActive();
std::shared_ptr<I2CDevice> getI2CDevice() const
{
@@ -61,5 +61,5 @@
void handleResponse(const boost::system::error_code& err, size_t bytesRead);
void restartRead();
- void checkThresholds(void) override;
+ void checkThresholds() override;
};
diff --git a/src/IntelCPUSensor.cpp b/src/IntelCPUSensor.cpp
index e10b8ea..5bf0fb6 100644
--- a/src/IntelCPUSensor.cpp
+++ b/src/IntelCPUSensor.cpp
@@ -111,7 +111,7 @@
}
}
-void IntelCPUSensor::restartRead(void)
+void IntelCPUSensor::restartRead()
{
std::weak_ptr<IntelCPUSensor> weakRef = weak_from_this();
waitTimer.expires_after(std::chrono::milliseconds(pollTime));
@@ -130,7 +130,7 @@
});
}
-void IntelCPUSensor::setupRead(void)
+void IntelCPUSensor::setupRead()
{
if (readingStateGood())
{
@@ -166,7 +166,7 @@
});
}
-void IntelCPUSensor::updateMinMaxValues(void)
+void IntelCPUSensor::updateMinMaxValues()
{
const boost::container::flat_map<
std::string,
@@ -322,7 +322,7 @@
restartRead();
}
-void IntelCPUSensor::checkThresholds(void)
+void IntelCPUSensor::checkThresholds()
{
if (show)
{
diff --git a/src/IntelCPUSensor.hpp b/src/IntelCPUSensor.hpp
index 0417c6e..88e6040 100644
--- a/src/IntelCPUSensor.hpp
+++ b/src/IntelCPUSensor.hpp
@@ -34,7 +34,7 @@
static constexpr unsigned int sensorPollMs = 1000;
static constexpr size_t warnAfterErrorCount = 10;
static constexpr const char* labelTcontrol = "Tcontrol";
- void setupRead(void);
+ void setupRead();
private:
sdbusplus::asio::object_server& objServer;
@@ -51,9 +51,9 @@
uint8_t minMaxReadCounter{0};
int fd{};
void handleResponse(const boost::system::error_code& err);
- void checkThresholds(void) override;
- void updateMinMaxValues(void);
- void restartRead(void);
+ void checkThresholds() override;
+ void updateMinMaxValues();
+ void restartRead();
};
extern boost::container::flat_map<std::string, std::shared_ptr<IntelCPUSensor>>
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index 3ee8283..519a05b 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -98,7 +98,7 @@
objectServer.remove_interface(association);
}
-std::string IpmbSensor::getSubTypeUnits(void) const
+std::string IpmbSensor::getSubTypeUnits() const
{
switch (subType)
{
@@ -117,7 +117,7 @@
}
}
-void IpmbSensor::init(void)
+void IpmbSensor::init()
{
loadDefaults();
setInitialProperties(getSubTypeUnits());
@@ -260,7 +260,7 @@
}
}
-void IpmbSensor::checkThresholds(void)
+void IpmbSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
@@ -401,7 +401,7 @@
read();
}
-void IpmbSensor::read(void)
+void IpmbSensor::read()
{
waitTimer.expires_after(std::chrono::milliseconds(sensorPollMs));
waitTimer.async_wait(
diff --git a/src/IpmbSensor.hpp b/src/IpmbSensor.hpp
index 54a2a4a..58f20d5 100644
--- a/src/IpmbSensor.hpp
+++ b/src/IpmbSensor.hpp
@@ -91,12 +91,12 @@
std::string& sensorTypeName);
~IpmbSensor() override;
- void checkThresholds(void) override;
- void read(void);
- void init(void);
- std::string getSubTypeUnits(void) const;
- void loadDefaults(void);
- void runInitCmd(void);
+ void checkThresholds() override;
+ void read();
+ void init();
+ std::string getSubTypeUnits() const;
+ void loadDefaults();
+ void runInitCmd();
bool processReading(const std::vector<uint8_t>& data, double& resp);
void parseConfigValues(const SensorBaseConfigMap& entry);
bool sensorClassType(const std::string& sensorClass);
@@ -120,7 +120,7 @@
ReadingFormat readingFormat = ReadingFormat::byte0;
private:
- void sendIpmbRequest(void);
+ void sendIpmbRequest();
sdbusplus::asio::object_server& objectServer;
boost::asio::steady_timer waitTimer;
void ipmbRequestCompletionCb(const boost::system::error_code& ec,
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index 8022e8c..fef23e9 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -89,13 +89,13 @@
objectServer.remove_interface(association);
}
-void MCUTempSensor::init(void)
+void MCUTempSensor::init()
{
setInitialProperties(sensor_paths::unitDegreesC);
read();
}
-void MCUTempSensor::checkThresholds(void)
+void MCUTempSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
@@ -150,7 +150,7 @@
return 0;
}
-void MCUTempSensor::read(void)
+void MCUTempSensor::read()
{
static constexpr size_t pollTime = 1; // in seconds
diff --git a/src/MCUTempSensor.hpp b/src/MCUTempSensor.hpp
index 4007546..2948af3 100644
--- a/src/MCUTempSensor.hpp
+++ b/src/MCUTempSensor.hpp
@@ -19,9 +19,9 @@
uint8_t busId, uint8_t mcuAddress, uint8_t tempReg);
~MCUTempSensor() override;
- void checkThresholds(void) override;
- void read(void);
- void init(void);
+ void checkThresholds() override;
+ void read();
+ void init();
uint8_t busId;
uint8_t mcuAddress;
diff --git a/src/NVMeContext.hpp b/src/NVMeContext.hpp
index 14e38a1..4eb81e4 100644
--- a/src/NVMeContext.hpp
+++ b/src/NVMeContext.hpp
@@ -106,4 +106,4 @@
using NVMEMap = boost::container::flat_map<int, std::shared_ptr<NVMeContext>>;
-NVMEMap& getNVMEMap(void);
+NVMEMap& getNVMEMap();
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index f22bf70..9c1b631 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -85,7 +85,7 @@
return scanDelay == 0;
}
-void NVMeSensor::checkThresholds(void)
+void NVMeSensor::checkThresholds()
{
thresholds::checkThresholds(this);
}
diff --git a/src/NVMeSensor.hpp b/src/NVMeSensor.hpp
index 7f2f114..a7cfba1 100644
--- a/src/NVMeSensor.hpp
+++ b/src/NVMeSensor.hpp
@@ -29,5 +29,5 @@
sdbusplus::asio::object_server& objServer;
unsigned int scanDelay{0};
- void checkThresholds(void) override;
+ void checkThresholds() override;
};
diff --git a/src/PSUEvent.cpp b/src/PSUEvent.cpp
index f8cee21..4f73cec 100644
--- a/src/PSUEvent.cpp
+++ b/src/PSUEvent.cpp
@@ -184,7 +184,7 @@
inputDev.close();
}
-void PSUSubEvent::setupRead(void)
+void PSUSubEvent::setupRead()
{
if (!readingStateGood(readState))
{
diff --git a/src/PSUEvent.hpp b/src/PSUEvent.hpp
index 4c705a4..d761f45 100644
--- a/src/PSUEvent.hpp
+++ b/src/PSUEvent.hpp
@@ -53,7 +53,7 @@
std::shared_ptr<std::set<std::string>> asserts;
std::shared_ptr<std::set<std::string>> combineEvent;
std::shared_ptr<bool> assertState;
- void setupRead(void);
+ void setupRead();
private:
int value = 0;
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index 0c763c0..96f849a 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -134,7 +134,7 @@
path = "";
}
-void PSUSensor::setupRead(void)
+void PSUSensor::setupRead()
{
if (!readingStateGood())
{
@@ -169,7 +169,7 @@
});
}
-void PSUSensor::restartRead(void)
+void PSUSensor::restartRead()
{
std::weak_ptr<PSUSensor> weakRef = weak_from_this();
waitTimer.expires_after(std::chrono::milliseconds(sensorPollMs));
@@ -231,7 +231,7 @@
restartRead();
}
-void PSUSensor::checkThresholds(void)
+void PSUSensor::checkThresholds()
{
if (!readingStateGood())
{
diff --git a/src/PSUSensor.hpp b/src/PSUSensor.hpp
index 69f365b..f9b738f 100644
--- a/src/PSUSensor.hpp
+++ b/src/PSUSensor.hpp
@@ -27,11 +27,11 @@
const std::string& label, size_t tSize, double pollRate,
const std::shared_ptr<I2CDevice>& i2cDevice);
~PSUSensor() override;
- void setupRead(void);
+ void setupRead();
void activate(const std::string& newPath,
const std::shared_ptr<I2CDevice>& newI2CDevice);
- void deactivate(void);
- bool isActive(void);
+ void deactivate();
+ bool isActive();
std::shared_ptr<I2CDevice> getI2CDevice() const
{
@@ -53,7 +53,7 @@
thresholds::ThresholdTimer thresholdTimer;
void restartRead();
void handleResponse(const boost::system::error_code& err, size_t bytesRead);
- void checkThresholds(void) override;
+ void checkThresholds() override;
unsigned int sensorPollMs = defaultSensorPollMs;
static constexpr size_t warnAfterErrorCount = 10;
diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp
index 89ae913..35610c5 100644
--- a/src/PSUSensorMain.cpp
+++ b/src/PSUSensorMain.cpp
@@ -1053,7 +1053,7 @@
getter->getConfiguration(types);
}
-void propertyInitialize(void)
+void propertyInitialize()
{
sensorTable = {{"power", sensor_paths::unitWatts},
{"curr", sensor_paths::unitAmperes},
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index 7c026b8..0a7048a 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -191,7 +191,7 @@
restartRead(pollTime);
}
-void TachSensor::checkThresholds(void)
+void TachSensor::checkThresholds()
{
bool status = thresholds::checkThresholds(this);
@@ -253,7 +253,7 @@
gpioLine.release();
}
-void PresenceSensor::monitorPresence(void)
+void PresenceSensor::monitorPresence()
{
gpioFd.async_wait(boost::asio::posix::stream_descriptor::wait_read,
[this](const boost::system::error_code& ec) {
@@ -274,7 +274,7 @@
});
}
-void PresenceSensor::read(void)
+void PresenceSensor::read()
{
gpioLine.event_read();
status = (gpioLine.get_value() != 0);
@@ -289,7 +289,7 @@
}
}
-bool PresenceSensor::getValue(void) const
+bool PresenceSensor::getValue() const
{
return status;
}
diff --git a/src/TachSensor.hpp b/src/TachSensor.hpp
index b53b5ae..845fbec 100644
--- a/src/TachSensor.hpp
+++ b/src/TachSensor.hpp
@@ -23,9 +23,9 @@
boost::asio::io_context& io, const std::string& name);
~PresenceSensor();
- void monitorPresence(void);
- void read(void);
- bool getValue(void) const;
+ void monitorPresence();
+ void read();
+ bool getValue() const;
private:
bool status = true;
@@ -96,7 +96,7 @@
void handleResponse(const boost::system::error_code& err, size_t bytesRead);
void restartRead(size_t pollTime);
- void checkThresholds(void) override;
+ void checkThresholds() override;
};
inline void logFanInserted(const std::string& device)
@@ -113,13 +113,13 @@
device);
}
-inline void logFanRedundancyLost(void)
+inline void logFanRedundancyLost()
{
const auto* msg = "OpenBMC.0.1.FanRedundancyLost";
lg2::error("Fan Inserted", "REDFISH_MESSAGE_ID", msg);
}
-inline void logFanRedundancyRestored(void)
+inline void logFanRedundancyRestored()
{
const auto* msg = "OpenBMC.0.1.FanRedundancyRegained";
lg2::error("Fan Removed", "REDFISH_MESSAGE_ID", msg);
diff --git a/src/Utils.cpp b/src/Utils.cpp
index f109b4d..ca125db 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -282,7 +282,7 @@
return true;
}
-bool isPowerOn(void)
+bool isPowerOn()
{
if (!powerMatch)
{
@@ -291,7 +291,7 @@
return powerStatusOn;
}
-bool hasBiosPost(void)
+bool hasBiosPost()
{
if (!postMatch)
{
@@ -300,7 +300,7 @@
return biosHasPost;
}
-bool isChassisOn(void)
+bool isChassisOn()
{
if (!chassisMatch)
{
diff --git a/src/Utils.hpp b/src/Utils.hpp
index 9652e63..f3e0753 100644
--- a/src/Utils.hpp
+++ b/src/Utils.hpp
@@ -68,9 +68,9 @@
std::string_view matchString,
std::vector<std::filesystem::path>& foundPaths,
int symlinkDepth = 1);
-bool isPowerOn(void);
-bool hasBiosPost(void);
-bool isChassisOn(void);
+bool isPowerOn();
+bool hasBiosPost();
+bool isChassisOn();
void setupPowerMatchCallback(
const std::shared_ptr<sdbusplus::asio::connection>& conn,
std::function<void(PowerState type, bool state)>&& callback);
diff --git a/src/sensor.hpp b/src/sensor.hpp
index b12c01a..7d22160 100644
--- a/src/sensor.hpp
+++ b/src/sensor.hpp
@@ -77,7 +77,7 @@
: nullptr)
{}
virtual ~Sensor() = default;
- virtual void checkThresholds(void) = 0;
+ virtual void checkThresholds() = 0;
std::string name;
std::string configurationPath;
std::string configInterface;