Enable cppcoreguidelines-init-variables
We try to enforce this rule, but clearly the robot can do a better job.
Enable the rule, and for init of all variables that clang-tidy finds in
error.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Icf64bc51b3180de29f7e92fa5c5f636e6b1462a6
diff --git a/include/ExitAirTempSensor.hpp b/include/ExitAirTempSensor.hpp
index 55da203..2008291 100644
--- a/include/ExitAirTempSensor.hpp
+++ b/include/ExitAirTempSensor.hpp
@@ -13,11 +13,11 @@
struct CFMSensor : public Sensor, std::enable_shared_from_this<CFMSensor>
{
std::vector<std::string> tachs;
- double c1;
- double c2;
- double maxCFM;
- double tachMinPercent;
- double tachMaxPercent;
+ double c1 = 0.0;
+ double c2 = 0.0;
+ double maxCFM = 0.0;
+ double tachMinPercent = 0.0;
+ double tachMaxPercent = 0.0;
std::shared_ptr<ExitAirTempSensor> parent;
@@ -51,13 +51,13 @@
std::enable_shared_from_this<ExitAirTempSensor>
{
- double powerFactorMin;
- double powerFactorMax;
- double qMin;
- double qMax;
- double alphaS;
- double alphaF;
- double pOffset = 0;
+ double powerFactorMin = 0.0;
+ double powerFactorMax = 0.0;
+ double qMin = 0.0;
+ double qMax = 0.0;
+ double alphaS = 0.0;
+ double alphaF = 0.0;
+ double pOffset = 0.0;
ExitAirTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
const std::string& name,
@@ -71,7 +71,7 @@
void setupMatches(void);
private:
- double lastReading;
+ double lastReading = 0.0;
std::vector<sdbusplus::bus::match::match> matches;
double inletTemp = std::numeric_limits<double>::quiet_NaN();
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index 18d10c1..b23c0f3 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -12,6 +12,7 @@
enum class IpmbType
{
+ none,
meSensor,
PXE1410CVR,
IR38363VR,
@@ -21,6 +22,7 @@
enum class IpmbSubType
{
+ none,
temp,
curr,
power,
@@ -92,22 +94,22 @@
void runInitCmd(void);
bool processReading(const std::vector<uint8_t>& data, double& resp);
- IpmbType type;
- IpmbSubType subType;
- double scaleVal;
- double offsetVal;
- uint8_t commandAddress;
- uint8_t netfn;
- uint8_t command;
- uint8_t deviceAddress;
- uint8_t errorCount;
- uint8_t hostSMbusIndex;
+ IpmbType type = IpmbType::none;
+ IpmbSubType subType = IpmbSubType::none;
+ double scaleVal = 1.0;
+ double offsetVal = 0.0;
+ uint8_t commandAddress = 0;
+ uint8_t netfn = 0;
+ uint8_t command = 0;
+ uint8_t deviceAddress = 0;
+ uint8_t errorCount = 0;
+ uint8_t hostSMbusIndex = 0;
std::vector<uint8_t> commandData;
std::optional<uint8_t> initCommand;
std::vector<uint8_t> initData;
int sensorPollMs;
- ReadingFormat readingFormat;
+ ReadingFormat readingFormat = ReadingFormat::byte0;
private:
sdbusplus::asio::object_server& objectServer;