Enable clang warnings
This commit enables clang warnings, and fixes all warnings that were
found. Most of these fall into a couple categories:
Variable shadow issues were fixed by renaming variables
unused parameter warnings were resolved by either checking error codes
that had been ignored, or removing the name of the variable from the
scope.
Other various warnings were fixed in the best way I was able to come up
with.
Note, the redfish Node class is especially insidious, as it causes all
imlementers to have variables for parameters, regardless of whether or
not they are used. Deprecating the Node class is on my list of things
to do, as it adds extra overhead, and in general isn't a useful
abstraction. For now, I have simply fixed all the handlers.
Tested:
Added the current meta-clang meta layer into bblayers.conf, and added
TOOLCHAIN_pn-bmcweb = "clang" to my local.conf
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 59c8a27..4f21b3e 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -28,13 +28,13 @@
struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
{
- HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp) :
- asyncResp(asyncResp), jsonStatus(asyncResp->res.jsonValue["Status"])
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncRespIn) :
+ asyncResp(asyncRespIn), jsonStatus(asyncResp->res.jsonValue["Status"])
{}
- HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp,
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncRespIn,
nlohmann::json& status) :
- asyncResp(asyncResp),
+ asyncResp(asyncRespIn),
jsonStatus(status)
{}
@@ -46,10 +46,10 @@
health = "OK";
rollup = "OK";
- for (const std::shared_ptr<HealthPopulate>& health : children)
+ for (const std::shared_ptr<HealthPopulate>& healthChild : children)
{
- health->globalInventoryPath = globalInventoryPath;
- health->statuses = statuses;
+ healthChild->globalInventoryPath = globalInventoryPath;
+ healthChild->statuses = statuses;
}
for (const auto& [path, interfaces] : statuses)
@@ -232,4 +232,4 @@
std::string globalInventoryPath = "-"; // default to illegal dbus path
bool populated = false;
};
-} // namespace redfish
\ No newline at end of file
+} // namespace redfish