summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2020-07-25 22:02:03 +0300
committerEd Tanous <ed@tanous.net>2020-08-17 23:54:37 +0300
commitcb13a39253848ece442971301ade9c09d98bf08e (patch)
tree62f2a64fbc98d8ee635a0a81f3ef07afa541981d /include
parent23a21a1cbed23ace4174664950e595df961e9e69 (diff)
downloadbmcweb-cb13a39253848ece442971301ade9c09d98bf08e.tar.xz
Enable unused variable warnings and resolve
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'include')
-rw-r--r--include/dbus_monitor.hpp9
-rw-r--r--include/ibm/management_console_rest.hpp12
-rw-r--r--include/image_upload.hpp9
-rw-r--r--include/kvm_websocket.hpp9
-rw-r--r--include/obmc_console.hpp27
-rw-r--r--include/openbmc_dbus_rest.hpp19
-rw-r--r--include/redfish_v1.hpp2
-rw-r--r--include/vm_websocket.hpp25
-rw-r--r--include/webassets.hpp4
9 files changed, 60 insertions, 56 deletions
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 4a5c7c60ea..3f0b826a9e 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -120,14 +120,15 @@ inline void requestRoutes(App& app)
.privileges({"Login"})
.websocket()
.onopen([&](crow::websocket::Connection& conn,
- std::shared_ptr<bmcweb::AsyncResp> asyncResp) {
+ std::shared_ptr<bmcweb::AsyncResp>) {
BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
sessions[&conn] = DbusWebsocketSession();
})
- .onclose([&](crow::websocket::Connection& conn,
- const std::string& reason) { sessions.erase(&conn); })
+ .onclose([&](crow::websocket::Connection& conn, const std::string&) {
+ sessions.erase(&conn);
+ })
.onmessage([&](crow::websocket::Connection& conn,
- const std::string& data, bool is_binary) {
+ const std::string& data, bool) {
DbusWebsocketSession& thisSession = sessions[&conn];
BMCWEB_LOG_DEBUG << "Connection " << &conn << " received " << data;
nlohmann::json j = nlohmann::json::parse(data, nullptr, false);
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index db1e9f32b6..6b77018664 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -532,7 +532,7 @@ void handleReleaseLockAPI(const crow::Request& req, crow::Response& res,
}
}
-void handleGetLockListAPI(const crow::Request& req, crow::Response& res,
+void handleGetLockListAPI(crow::Response& res,
const ListOfSessionIds& listSessionIds)
{
BMCWEB_LOG_DEBUG << listSessionIds.size();
@@ -581,7 +581,7 @@ void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/ibm/v1/")
.privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
res.jsonValue["@odata.type"] =
"#ibmServiceRoot.v1_0_0.ibmServiceRoot";
res.jsonValue["@odata.id"] = "/ibm/v1/";
@@ -599,7 +599,7 @@ void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles")
.privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
handleConfigFileList(res);
});
@@ -607,7 +607,7 @@ void requestRoutes(App& app)
"/ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll")
.privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::post)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
deleteConfigFiles(res);
});
@@ -621,7 +621,7 @@ void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService")
.privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
getLockServiceData(res);
});
@@ -682,7 +682,7 @@ void requestRoutes(App& app)
res.end();
return;
}
- handleGetLockListAPI(req, res, listSessionIds);
+ handleGetLockListAPI(res, listSessionIds);
});
BMCWEB_ROUTE(app, "/ibm/v1/HMC/BroadcastService")
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index a135af952b..9d0a0ca921 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -18,8 +18,7 @@ namespace image_upload
static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateMatcher;
-inline void uploadImageHandler(const crow::Request& req, crow::Response& res,
- const std::string& filename)
+inline void uploadImageHandler(const crow::Request& req, crow::Response& res)
{
// Only allow one FW update at a time
if (fwUpdateMatcher != nullptr)
@@ -115,15 +114,13 @@ inline void requestRoutes(App& app)
.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) {
- uploadImageHandler(req, res, filename);
- });
+ const std::string&) { uploadImageHandler(req, res); });
BMCWEB_ROUTE(app, "/upload/image")
.privileges({"ConfigureComponents", "ConfigureManager"})
.methods(boost::beast::http::verb::post, boost::beast::http::verb::put)(
[](const crow::Request& req, crow::Response& res) {
- uploadImageHandler(req, res, "");
+ uploadImageHandler(req, res);
});
}
} // namespace image_upload
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index f83c95b525..df50778e43 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -162,7 +162,7 @@ inline void requestRoutes(App& app)
.privileges({"ConfigureComponents", "ConfigureManager"})
.websocket()
.onopen([](crow::websocket::Connection& conn,
- std::shared_ptr<bmcweb::AsyncResp> asyncResp) {
+ std::shared_ptr<bmcweb::AsyncResp>) {
BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
if (sessions.size() == maxSessions)
@@ -173,10 +173,11 @@ inline void requestRoutes(App& app)
sessions[&conn] = std::make_unique<KvmSession>(conn);
})
- .onclose([](crow::websocket::Connection& conn,
- const std::string& reason) { sessions.erase(&conn); })
+ .onclose([](crow::websocket::Connection& conn, const std::string&) {
+ sessions.erase(&conn);
+ })
.onmessage([](crow::websocket::Connection& conn,
- const std::string& data, bool is_binary) {
+ const std::string& data, bool) {
if (sessions[&conn])
{
sessions[&conn]->onMessage(data);
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 036fe5a0a2..f2de85b7c9 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -107,7 +107,7 @@ inline void requestRoutes(App& app)
.privileges({"ConfigureComponents", "ConfigureManager"})
.websocket()
.onopen([](crow::websocket::Connection& conn,
- std::shared_ptr<bmcweb::AsyncResp> asyncResp) {
+ std::shared_ptr<bmcweb::AsyncResp>) {
BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
sessions.insert(&conn);
@@ -122,18 +122,19 @@ inline void requestRoutes(App& app)
host_socket->async_connect(ep, connectHandler);
}
})
- .onclose(
- [](crow::websocket::Connection& conn, const std::string& reason) {
- sessions.erase(&conn);
- if (sessions.empty())
- {
- host_socket = nullptr;
- inputBuffer.clear();
- inputBuffer.shrink_to_fit();
- }
- })
- .onmessage([](crow::websocket::Connection& conn,
- const std::string& data, bool is_binary) {
+ .onclose([](crow::websocket::Connection& conn,
+ [[maybe_unused]] const std::string& reason) {
+ sessions.erase(&conn);
+ if (sessions.empty())
+ {
+ host_socket = nullptr;
+ inputBuffer.clear();
+ inputBuffer.shrink_to_fit();
+ }
+ })
+ .onmessage([]([[maybe_unused]] crow::websocket::Connection& conn,
+ const std::string& data,
+ [[maybe_unused]] bool is_binary) {
inputBuffer += data;
doWrite();
});
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 57bfc88082..f049c00915 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -791,13 +791,13 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& arg_type,
}
nlohmann::json::const_iterator it = j->begin();
- for (const std::string& argCode : dbusArgSplit(arg_type))
+ for (const std::string& argCode2 : dbusArgSplit(arg_type))
{
if (it == j->end())
{
return -1;
}
- r = convertJsonToDbus(m, argCode, *it);
+ r = convertJsonToDbus(m, argCode2, *it);
if (r < 0)
{
return r;
@@ -1556,8 +1556,7 @@ inline void handleAction(const crow::Request& req, crow::Response& res,
std::array<std::string, 0>());
}
-inline void handleDelete(const crow::Request& req, crow::Response& res,
- const std::string& objectPath)
+inline void handleDelete(crow::Response& res, const std::string& objectPath)
{
BMCWEB_LOG_DEBUG << "handleDelete on path: " << objectPath;
@@ -2065,7 +2064,7 @@ inline void handleDBusUrl(const crow::Request& req, crow::Response& res,
}
else if (req.method() == boost::beast::http::verb::delete_)
{
- handleDelete(req, res, objectPath);
+ handleDelete(res, objectPath);
return;
}
@@ -2079,7 +2078,7 @@ inline void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/bus/")
.privileges({"Login"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
res.jsonValue = {{"buses", {{{"name", "system"}}}},
{"status", "ok"}};
res.end();
@@ -2088,7 +2087,7 @@ inline void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/bus/system/")
.privileges({"Login"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
auto myCallback = [&res](const boost::system::error_code ec,
std::vector<std::string>& names) {
if (ec)
@@ -2117,7 +2116,7 @@ inline void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/list/")
.privileges({"Login"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
handleList(res, "/");
});
@@ -2161,7 +2160,7 @@ inline void requestRoutes(App& app)
BMCWEB_ROUTE(app, "/download/dump/<str>/")
.privileges({"ConfigureManager"})
- .methods(boost::beast::http::verb::get)([](const crow::Request& req,
+ .methods(boost::beast::http::verb::get)([](const crow::Request&,
crow::Response& res,
const std::string& dumpId) {
std::regex validFilename("^[\\w\\- ]+(\\.?[\\w\\- ]*)$");
@@ -2231,7 +2230,7 @@ inline void requestRoutes(App& app)
.privileges({"Login"})
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res,
+ [](const crow::Request&, crow::Response& res,
const std::string& Connection) {
introspectObjects(Connection, "/",
std::make_shared<bmcweb::AsyncResp>(res));
diff --git a/include/redfish_v1.hpp b/include/redfish_v1.hpp
index cb7af8f1b8..1e4bd658e6 100644
--- a/include/redfish_v1.hpp
+++ b/include/redfish_v1.hpp
@@ -10,7 +10,7 @@ inline void requestRoutes(App& app)
{
BMCWEB_ROUTE(app, "/redfish/")
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& req, crow::Response& res) {
+ [](const crow::Request&, crow::Response& res) {
res.jsonValue = {{"v1", "/redfish/v1/"}};
res.end();
});
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index d07469eba2..da9a06f040 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -160,7 +160,7 @@ inline void requestRoutes(App& app)
.privileges({"ConfigureComponents", "ConfigureManager"})
.websocket()
.onopen([](crow::websocket::Connection& conn,
- std::shared_ptr<bmcweb::AsyncResp> asyncResp) {
+ std::shared_ptr<bmcweb::AsyncResp>) {
BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
if (session != nullptr)
@@ -183,16 +183,21 @@ inline void requestRoutes(App& app)
handler = std::make_shared<Handler>(media, conn.get_io_context());
handler->connect();
})
- .onclose(
- [](crow::websocket::Connection& conn, const std::string& reason) {
- session = nullptr;
- handler->doClose();
- handler->inputBuffer->clear();
- handler->outputBuffer->clear();
- handler.reset();
- })
+ .onclose([](crow::websocket::Connection& conn,
+ const std::string& /*reason*/) {
+ if (&conn != session)
+ {
+ return;
+ }
+
+ session = nullptr;
+ handler->doClose();
+ handler->inputBuffer->clear();
+ handler->outputBuffer->clear();
+ handler.reset();
+ })
.onmessage([](crow::websocket::Connection& conn,
- const std::string& data, bool is_binary) {
+ const std::string& data, bool) {
if (data.length() > handler->inputBuffer->capacity())
{
BMCWEB_LOG_ERROR << "Buffer overrun when writing "
diff --git a/include/webassets.hpp b/include/webassets.hpp
index 7e382d886c..7cf6c93e3a 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -128,8 +128,8 @@ inline void requestRoutes(App& app)
}
app.routeDynamic(webpath)(
- [absolutePath, contentType, contentEncoding](
- const crow::Request& req, crow::Response& res) {
+ [absolutePath, contentType,
+ contentEncoding](const crow::Request&, crow::Response& res) {
if (contentType != nullptr)
{
res.addHeader("Content-Type", contentType);