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/include/task_messages.hpp b/redfish-core/include/task_messages.hpp
index 050cc63..33c2db5 100644
--- a/redfish-core/include/task_messages.hpp
+++ b/redfish-core/include/task_messages.hpp
@@ -20,7 +20,7 @@
namespace messages
{
-nlohmann::json taskAborted(const std::string& arg1)
+inline nlohmann::json taskAborted(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -31,7 +31,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskCancelled(const std::string& arg1)
+inline nlohmann::json taskCancelled(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -42,7 +42,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskCompletedOK(const std::string& arg1)
+inline nlohmann::json taskCompletedOK(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -53,7 +53,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskCompletedWarning(const std::string& arg1)
+inline nlohmann::json taskCompletedWarning(const std::string& arg1)
{
return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"},
{"MessageId", "TaskEvent.1.0.1.TaskCompletedWarning"},
@@ -64,7 +64,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskPaused(const std::string& arg1)
+inline nlohmann::json taskPaused(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -75,7 +75,8 @@
{"Resolution", "None."}};
}
-nlohmann::json taskProgressChanged(const std::string& arg1, const size_t arg2)
+inline nlohmann::json taskProgressChanged(const std::string& arg1,
+ const size_t arg2)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -87,7 +88,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskRemoved(const std::string& arg1)
+inline nlohmann::json taskRemoved(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -98,7 +99,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskResumed(const std::string& arg1)
+inline nlohmann::json taskResumed(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},
@@ -109,7 +110,7 @@
{"Resolution", "None."}};
}
-nlohmann::json taskStarted(const std::string& arg1)
+inline nlohmann::json taskStarted(const std::string& arg1)
{
return nlohmann::json{
{"@odata.type", "#Message.v1_0_0.Message"},