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/include/image_upload.hpp b/include/image_upload.hpp
index af7aeac..a135af9 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -16,7 +16,7 @@
namespace image_upload
{
-std::unique_ptr<sdbusplus::bus::match::match> fwUpdateMatcher;
+static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateMatcher;
inline void uploadImageHandler(const crow::Request& req, crow::Response& res,
const std::string& filename)
@@ -109,10 +109,10 @@
timeout.async_wait(timeoutHandler);
}
-void requestRoutes(App& app)
+inline void requestRoutes(App& app)
{
BMCWEB_ROUTE(app, "/upload/image/<str>")
- .requires({"ConfigureComponents", "ConfigureManager"})
+ .privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::post, boost::beast::http::verb::put)(
[](const crow::Request& req, crow::Response& res,
const std::string& filename) {
@@ -120,7 +120,7 @@
});
BMCWEB_ROUTE(app, "/upload/image")
- .requires({"ConfigureComponents", "ConfigureManager"})
+ .privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::post, boost::beast::http::verb::put)(
[](const crow::Request& req, crow::Response& res) {
uploadImageHandler(req, res, "");