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/http/app.h b/http/app.h
index dfd5304..b810374 100644
--- a/http/app.h
+++ b/http/app.h
@@ -97,13 +97,13 @@
 #ifdef BMCWEB_ENABLE_SSL
         if (-1 == socketFd)
         {
-            sslServer = std::move(std::make_unique<ssl_server_t>(
-                this, bindaddrStr, portUint, sslContext, io));
+            sslServer = std::make_unique<ssl_server_t>(
+                this, bindaddrStr, portUint, sslContext, io);
         }
         else
         {
-            sslServer = std::move(
-                std::make_unique<ssl_server_t>(this, socketFd, sslContext, io));
+            sslServer =
+                std::make_unique<ssl_server_t>(this, socketFd, sslContext, io);
         }
         sslServer->setTickFunction(tickInterval, tickFunction);
         sslServer->run();
diff --git a/http/common.h b/http/common.h
index 77db63c..95cc763 100644
--- a/http/common.h
+++ b/http/common.h
@@ -12,33 +12,6 @@
 namespace crow
 {
 
-inline std::string methodName(boost::beast::http::verb method)
-{
-    switch (method)
-    {
-        case boost::beast::http::verb::delete_:
-            return "DELETE";
-        case boost::beast::http::verb::get:
-            return "GET";
-        case boost::beast::http::verb::head:
-            return "HEAD";
-        case boost::beast::http::verb::post:
-            return "POST";
-        case boost::beast::http::verb::put:
-            return "PUT";
-        case boost::beast::http::verb::connect:
-            return "CONNECT";
-        case boost::beast::http::verb::options:
-            return "OPTIONS";
-        case boost::beast::http::verb::trace:
-            return "TRACE";
-        case boost::beast::http::verb::patch:
-            return "PATCH";
-        default:
-            return "invalid";
-    }
-}
-
 enum class ParamType
 {
     INT,
diff --git a/http/http_client.hpp b/http/http_client.hpp
index e6a7db1..c455c7b 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -302,8 +302,6 @@
                 sendMessage(data);
                 break;
             }
-            default:
-                break;
         }
     }
 
diff --git a/http/http_connection.h b/http/http_connection.h
index 609d4a1..855cc11 100644
--- a/http/http_connection.h
+++ b/http/http_connection.h
@@ -176,7 +176,7 @@
             bool isKeyUsageKeyAgreement = false;
 
             ASN1_BIT_STRING* usage = static_cast<ASN1_BIT_STRING*>(
-                X509_get_ext_d2i(peerCert, NID_key_usage, NULL, NULL));
+                X509_get_ext_d2i(peerCert, NID_key_usage, nullptr, nullptr));
 
             if (usage == nullptr)
             {
@@ -208,8 +208,9 @@
 
             // Determine that ExtendedKeyUsage includes Client Auth
 
-            stack_st_ASN1_OBJECT* extUsage = static_cast<stack_st_ASN1_OBJECT*>(
-                X509_get_ext_d2i(peerCert, NID_ext_key_usage, NULL, NULL));
+            stack_st_ASN1_OBJECT* extUsage =
+                static_cast<stack_st_ASN1_OBJECT*>(X509_get_ext_d2i(
+                    peerCert, NID_ext_key_usage, nullptr, nullptr));
 
             if (extUsage == nullptr)
             {
@@ -348,7 +349,7 @@
 
         if (!isInvalidRequest)
         {
-            req->socket = [this, self = shared_from_this()]() -> Adaptor& {
+            req->socket = [self = shared_from_this()]() -> Adaptor& {
                 return self->socket();
             };
 
diff --git a/http/http_response.h b/http/http_response.h
index 7be6b09..68e3f2d 100644
--- a/http/http_response.h
+++ b/http/http_response.h
@@ -104,7 +104,7 @@
     void preparePayload()
     {
         stringResponse->prepare_payload();
-    };
+    }
 
     void clear()
     {
diff --git a/http/http_server.h b/http/http_server.h
index c87ddd4..0099274 100644
--- a/http/http_server.h
+++ b/http/http_server.h
@@ -31,14 +31,14 @@
 class Server
 {
   public:
-    Server(Handler* handler, std::unique_ptr<tcp::acceptor>&& acceptor,
+    Server(Handler* handlerIn, std::unique_ptr<tcp::acceptor>&& acceptor,
            std::shared_ptr<boost::asio::ssl::context> adaptor_ctx,
            std::shared_ptr<boost::asio::io_context> io =
                std::make_shared<boost::asio::io_context>()) :
         ioService(std::move(io)),
         acceptor(std::move(acceptor)),
         signals(*ioService, SIGINT, SIGTERM, SIGHUP), tickTimer(*ioService),
-        timer(*ioService), handler(handler), adaptorCtx(adaptor_ctx)
+        timer(*ioService), handler(handlerIn), adaptorCtx(adaptor_ctx)
     {}
 
     Server(Handler* handler, const std::string& bindaddr, uint16_t port,
@@ -93,7 +93,7 @@
         size_t dateStrSz =
             strftime(&dateStr[0], 99, "%a, %d %b %Y %H:%M:%S GMT", &myTm);
         dateStr.resize(dateStrSz);
-    };
+    }
 
     void run()
     {
diff --git a/http/routing.h b/http/routing.h
index 2f90c07..1af1b2b 100644
--- a/http/routing.h
+++ b/http/routing.h
@@ -219,7 +219,7 @@
     template <typename Req, typename... Args>
     struct ReqHandlerWrapper
     {
-        ReqHandlerWrapper(Func f) : f(std::move(f))
+        ReqHandlerWrapper(Func fIn) : f(std::move(fIn))
         {}
 
         void operator()(const Request& req, Response& res, Args... args)
@@ -315,7 +315,7 @@
     using self_t = WebSocketRule;
 
   public:
-    WebSocketRule(std::string rule) : BaseRule(std::move(rule))
+    WebSocketRule(std::string ruleIn) : BaseRule(std::move(ruleIn))
     {}
 
     void validate() override
@@ -428,7 +428,7 @@
     }
 
     template <typename... MethodArgs>
-    self_t& requires(std::initializer_list<const char*> l)
+    self_t& privileges(std::initializer_list<const char*> l)
     {
         self_t* self = static_cast<self_t*>(this);
         self->privilegesSet.emplace_back(l);
@@ -436,7 +436,7 @@
     }
 
     template <typename... MethodArgs>
-    self_t& requires(const std::vector<redfish::Privileges>& p)
+    self_t& privileges(const std::vector<redfish::Privileges>& p)
     {
         self_t* self = static_cast<self_t*>(this);
         for (const redfish::Privileges& privilege : p)
@@ -450,7 +450,7 @@
 class DynamicRule : public BaseRule, public RuleParameterTraits<DynamicRule>
 {
   public:
-    DynamicRule(std::string rule) : BaseRule(std::move(rule))
+    DynamicRule(std::string ruleIn) : BaseRule(std::move(ruleIn))
     {}
 
     void validate() override
@@ -982,7 +982,7 @@
                     case ParamType::PATH:
                         BMCWEB_LOG_DEBUG << "<path>";
                         break;
-                    default:
+                    case ParamType::MAX:
                         BMCWEB_LOG_DEBUG << "<ERROR>";
                         break;
                 }
@@ -1203,9 +1203,9 @@
             // Check to see if this url exists at any verb
             for (const PerMethod& p : perMethods)
             {
-                const std::pair<unsigned, RoutingParams>& found =
+                const std::pair<unsigned, RoutingParams>& found2 =
                     p.trie.find(req.url);
-                if (found.first > 0)
+                if (found2.first > 0)
                 {
                     res.result(boost::beast::http::status::method_not_allowed);
                     res.end();
@@ -1340,7 +1340,7 @@
                     }
                 }
 
-                // Get the user privileges from the role
+                // Get the userprivileges from the role
                 redfish::Privileges userPrivileges =
                     redfish::getUserPrivileges(userRole);
 
@@ -1349,10 +1349,10 @@
                 // value from any previous use of this session.
                 req.session->isConfigureSelfOnly = passwordExpired;
 
-                // Modify privileges if isConfigureSelfOnly.
+                // Modifyprivileges if isConfigureSelfOnly.
                 if (req.session->isConfigureSelfOnly)
                 {
-                    // Remove all privileges except ConfigureSelf
+                    // Remove allprivileges except ConfigureSelf
                     userPrivileges = userPrivileges.intersection(
                         redfish::Privileges{"ConfigureSelf"});
                     BMCWEB_LOG_DEBUG << "Operation limited to ConfigureSelf";
@@ -1384,8 +1384,8 @@
     {
         for (size_t i = 0; i < perMethods.size(); i++)
         {
-            BMCWEB_LOG_DEBUG
-                << methodName(static_cast<boost::beast::http::verb>(i));
+            BMCWEB_LOG_DEBUG << boost::beast::http::to_string(
+                static_cast<boost::beast::http::verb>(i));
             perMethods[i].trie.debugPrint();
         }
     }
diff --git a/http/utility.h b/http/utility.h
index 8254091..fad212f 100644
--- a/http/utility.h
+++ b/http/utility.h
@@ -39,7 +39,8 @@
     }
     constexpr char operator[](unsigned i) const
     {
-        return requiresInRange(i, sizeUint), beginPtr[i];
+        requiresInRange(i, sizeUint);
+        return beginPtr[i];
     }
 
     constexpr operator const char*() const
@@ -760,9 +761,8 @@
 inline void convertToLinks(std::string& s)
 {
     // Convert anything with a redfish path into a link
-    const static std::regex redfishPath{
-        "(&quot;((.*))&quot;[ \\n]*:[ "
-        "\\n]*)(&quot;((?!&quot;)/redfish/.*)&quot;)"};
+    const std::regex redfishPath{"(&quot;((.*))&quot;[ \\n]*:[ "
+                                 "\\n]*)(&quot;((?!&quot;)/redfish/.*)&quot;)"};
     s = std::regex_replace(s, redfishPath, "$1<a href=\"$5\">$4</a>");
 }
 
diff --git a/http/websocket.h b/http/websocket.h
index 7670196..5ec6d0f 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -22,10 +22,12 @@
 {
   public:
     explicit Connection(const crow::Request& reqIn) :
-        req(reqIn.req), userdataPtr(nullptr){};
+        req(reqIn.req), userdataPtr(nullptr)
+    {}
 
     explicit Connection(const crow::Request& reqIn, std::string user) :
-        req(reqIn.req), userName{std::move(user)}, userdataPtr(nullptr){};
+        req(reqIn.req), userName{std::move(user)}, userdataPtr(nullptr)
+    {}
 
     virtual void sendBinary(const std::string_view msg) = 0;
     virtual void sendBinary(std::string&& msg) = 0;