Enable init checker
clang-tidy added cppcoreguidelines-init-variables as a check, which is
something we already enforce to some extent, but getting CI to enforce
it will help reviews move faster.
Tested: Code compiles. Noop changes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7e10950de617b1d3262265572b1703f2e60b69d0
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 8735178..ee8d2cd 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -635,9 +635,9 @@
*bits = 0;
}
- char* endPtr;
+ char* endPtr = nullptr;
long previousValue = 255;
- bool firstZeroInByteHit;
+ bool firstZeroInByteHit = false;
for (const std::string& byte : bytesInMask)
{
if (byte.empty())
@@ -1581,8 +1581,8 @@
return;
}
- const std::string* addr;
- uint8_t prefix;
+ const std::string* addr = nullptr;
+ uint8_t prefix = 0;
// Find the address and prefixLength values. Any values that are
// not explicitly provided are assumed to be unmodified from the
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 3a955cb..ad5c5e3 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1092,8 +1092,8 @@
std::vector<double> outputs;
for (auto& step : *steps)
{
- double target;
- double out;
+ double target = 0.0;
+ double out = 0.0;
if (!redfish::json_util::readJson(step, response->res, "Target",
target, "Output", out))
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index ae02189..cfa2bf5 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -62,7 +62,7 @@
const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& registry)
{
- const message_registries::Header* header;
+ const message_registries::Header* header = nullptr;
std::string dmtf = "DMTF ";
const char* url = nullptr;
@@ -127,7 +127,7 @@
const std::string& registry, const std::string& registryMatch)
{
- const message_registries::Header* header;
+ const message_registries::Header* header = nullptr;
std::vector<const message_registries::MessageEntry*> registryEntries;
if (registry == "Base")
{
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 6d10bb7..99dfc81 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -2758,10 +2758,10 @@
BMCWEB_LOG_INFO << "setSensorsOverride for subNode"
<< sensorAsyncResp->chassisSubNode << "\n";
- const char* propertyValueName;
+ const char* propertyValueName = nullptr;
std::unordered_map<std::string, std::pair<double, std::string>> overrideMap;
std::string memberId;
- double value;
+ double value = 0.0;
for (auto& collectionItems : allCollections)
{
if (collectionItems.first == "Temperatures")
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 2605c3f..e7f4f02 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1728,7 +1728,7 @@
BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
// OpenBMC only supports "Disabled" and "RetryAttempts".
- bool autoRebootEnabled;
+ bool autoRebootEnabled = false;
if (automaticRetryConfig == "Disabled")
{
@@ -2765,7 +2765,7 @@
// Get the command and host vs. chassis
std::string command;
- bool hostCommand;
+ bool hostCommand = true;
if ((resetType == "On") || (resetType == "ForceOn"))
{
command = "xyz.openbmc_project.State.Host.Transition.On";