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/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index b21fba5..797160d 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -53,7 +53,7 @@
 {
   public:
     template <typename... Params>
-    Node(App& app, std::string&& entityUrl, Params... paramsIn)
+    Node(App& app, std::string&& entityUrl, [[maybe_unused]] Params... paramsIn)
     {
         crow::DynamicRule& get = app.routeDynamic(entityUrl.c_str());
         getRule = &get;
@@ -157,36 +157,36 @@
 
   protected:
     // Node is designed to be an abstract class, so doGet is pure virtual
-    virtual void doGet(crow::Response& res, const crow::Request& req,
-                       const std::vector<std::string>& params)
+    virtual void doGet(crow::Response& res, const crow::Request&,
+                       const std::vector<std::string>&)
     {
         res.result(boost::beast::http::status::method_not_allowed);
         res.end();
     }
 
-    virtual void doPatch(crow::Response& res, const crow::Request& req,
-                         const std::vector<std::string>& params)
+    virtual void doPatch(crow::Response& res, const crow::Request&,
+                         const std::vector<std::string>&)
     {
         res.result(boost::beast::http::status::method_not_allowed);
         res.end();
     }
 
-    virtual void doPost(crow::Response& res, const crow::Request& req,
-                        const std::vector<std::string>& params)
+    virtual void doPost(crow::Response& res, const crow::Request&,
+                        const std::vector<std::string>&)
     {
         res.result(boost::beast::http::status::method_not_allowed);
         res.end();
     }
 
-    virtual void doPut(crow::Response& res, const crow::Request& req,
-                       const std::vector<std::string>& params)
+    virtual void doPut(crow::Response& res, const crow::Request&,
+                       const std::vector<std::string>&)
     {
         res.result(boost::beast::http::status::method_not_allowed);
         res.end();
     }
 
-    virtual void doDelete(crow::Response& res, const crow::Request& req,
-                          const std::vector<std::string>& params)
+    virtual void doDelete(crow::Response& res, const crow::Request&,
+                          const std::vector<std::string>&)
     {
         res.result(boost::beast::http::status::method_not_allowed);
         res.end();
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index d9bf1fc..2d44545 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -309,7 +309,7 @@
  */
 inline bool isMethodAllowedForUser(const boost::beast::http::verb method,
                                    const OperationMap& operationMap,
-                                   const std::string& user)
+                                   const std::string&)
 {
     // TODO: load user privileges from configuration as soon as its available
     // now we are granting all privileges to everyone.
diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp
index 9f0da8f..ada5da7 100644
--- a/redfish-core/include/server_sent_events.hpp
+++ b/redfish-core/include/server_sent_events.hpp
@@ -107,8 +107,9 @@
 
         sseConn->async_write_some(
             boost::asio::buffer(outBuffer.data(), outBuffer.size()),
-            [self(shared_from_this())](boost::beast::error_code ec,
-                                       const std::size_t& bytesTransferred) {
+            [self(shared_from_this())](
+                boost::beast::error_code ec,
+                [[maybe_unused]] const std::size_t& bytesTransferred) {
                 self->outBuffer.erase(0, bytesTransferred);
 
                 if (ec == boost::asio::error::eof)
@@ -131,7 +132,6 @@
                 }
                 BMCWEB_LOG_DEBUG << "async_write_some() bytes transferred: "
                                  << bytesTransferred;
-                boost::ignore_unused(bytesTransferred);
 
                 self->doWrite();
             });
@@ -164,8 +164,9 @@
 
         boost::beast::http::async_write_header(
             *sseConn, *serializer,
-            [this, response, serializer](const boost::beast::error_code& ec,
-                                         const std::size_t& bytesTransferred) {
+            [this, response,
+             serializer](const boost::beast::error_code& ec,
+                         [[maybe_unused]] const std::size_t& bytesTransferred) {
                 if (ec)
                 {
                     BMCWEB_LOG_ERROR << "Error sending header" << ec;
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index d578de4..c4f54d7 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -86,8 +86,7 @@
 };
 
 template <typename ToType, typename FromType>
-bool checkRange(const FromType& from, nlohmann::json& jsonValue,
-                const std::string& key)
+bool checkRange(const FromType& from, const std::string& key)
 {
     if (from > std::numeric_limits<ToType>::max())
     {
@@ -137,7 +136,7 @@
         {
             return UnpackErrorCode::invalidType;
         }
-        if (!checkRange<Type>(*jsonPtr, jsonValue, key))
+        if (!checkRange<Type>(*jsonPtr, key))
         {
             return UnpackErrorCode::outOfRange;
         }
@@ -151,7 +150,7 @@
         {
             return UnpackErrorCode::invalidType;
         }
-        if (!checkRange<Type>(*jsonPtr, jsonValue, key))
+        if (!checkRange<Type>(*jsonPtr, key))
         {
             return UnpackErrorCode::outOfRange;
         }
@@ -166,7 +165,7 @@
         {
             return UnpackErrorCode::invalidType;
         }
-        if (!checkRange<Type>(*jsonPtr, jsonValue, key))
+        if (!checkRange<Type>(*jsonPtr, key))
         {
             return UnpackErrorCode::outOfRange;
         }
@@ -326,8 +325,8 @@
 }
 
 template <size_t Count, size_t Index>
-bool readJsonValues(const std::string& key, nlohmann::json& jsonValue,
-                    crow::Response& res, std::bitset<Count>& handled)
+bool readJsonValues(const std::string& key, nlohmann::json&,
+                    crow::Response& res, std::bitset<Count>&)
 {
     BMCWEB_LOG_DEBUG << "Unable to find variable for key" << key;
     messages::propertyUnknown(res, key);
@@ -356,7 +355,7 @@
 }
 
 template <size_t Index = 0, size_t Count>
-bool handleMissing(std::bitset<Count>& handled, crow::Response& res)
+bool handleMissing(std::bitset<Count>&, crow::Response&)
 {
     return true;
 }
@@ -364,7 +363,7 @@
 template <size_t Index = 0, size_t Count, typename ValueType,
           typename... UnpackTypes>
 bool handleMissing(std::bitset<Count>& handled, crow::Response& res,
-                   const char* key, ValueType& unused, UnpackTypes&... in)
+                   const char* key, ValueType&, UnpackTypes&... in)
 {
     bool ret = true;
     if (!handled.test(Index) && !is_optional_v<ValueType>)