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>
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 036fe5a..f2de85b 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -107,7 +107,7 @@
.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 @@
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();
});