Fix shadowed variable issues

This patchset is the conclusion of a multi-year effort to try to fix
shadowed variable names.  Variables seem to be shadowed all over, and in
most places they exist, there's a "code smell" of things that aren't
doing what the author intended.

This commit attempts to clean up these in several ways by:
1. Renaming variables where appropriate.
2. Preferring to refer to member variables directly when operating
   within a class
3. Rearranging code so that pass through variables are handled in the
   calling scope, rather than passing them through.

These patterns are applied throughout the codebase, to the point where
-Wshadow can be enabled in meson.build.

Tested: Code compiles, unit tests pass.  Still need to run redfish
service validator.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If703398c2282f9e096ca2694fd94515de36a098b
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 571b5a9..ae077ef 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -93,11 +93,11 @@
     std::function<void(bool, uint32_t, Response&)> callback;
     RetryPolicyData retryPolicy;
     PendingRequest(
-        boost::beast::http::request<boost::beast::http::string_body>&& req,
-        const std::function<void(bool, uint32_t, Response&)>& callback,
-        const RetryPolicyData& retryPolicy) :
-        req(std::move(req)),
-        callback(callback), retryPolicy(retryPolicy)
+        boost::beast::http::request<boost::beast::http::string_body>&& reqIn,
+        const std::function<void(bool, uint32_t, Response&)>& callbackIn,
+        const RetryPolicyData& retryPolicyIn) :
+        req(std::move(reqIn)),
+        callback(callbackIn), retryPolicy(retryPolicyIn)
     {}
 };
 
@@ -394,11 +394,12 @@
     }
 
   public:
-    explicit ConnectionInfo(boost::asio::io_context& ioc, const std::string& id,
-                            const std::string& destIP, const uint16_t destPort,
-                            const unsigned int connId) :
-        subId(id),
-        host(destIP), port(destPort), connId(connId), conn(ioc), timer(ioc)
+    explicit ConnectionInfo(boost::asio::io_context& ioc,
+                            const std::string& idIn, const std::string& destIP,
+                            const uint16_t destPort,
+                            const unsigned int connIdIn) :
+        subId(idIn),
+        host(destIP), port(destPort), connId(connIdIn), conn(ioc), timer(ioc)
     {}
 };
 
@@ -598,11 +599,12 @@
     }
 
   public:
-    explicit ConnectionPool(boost::asio::io_context& ioc, const std::string& id,
-                            const std::string& destIP,
-                            const uint16_t destPort) :
-        ioc(ioc),
-        id(id), destIP(destIP), destPort(destPort)
+    explicit ConnectionPool(boost::asio::io_context& iocIn,
+                            const std::string& idIn,
+                            const std::string& destIPIn,
+                            const uint16_t destPortIn) :
+        ioc(iocIn),
+        id(idIn), destIP(destIPIn), destPort(destPortIn)
     {
         std::string clientKey = destIP + ":" + std::to_string(destPort);
         BMCWEB_LOG_DEBUG << "Initializing connection pool for " << destIP << ":"
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 55ea847..d20fd25 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -151,10 +151,10 @@
             }
 
             // Check if certificate is OK
-            int error = X509_STORE_CTX_get_error(cts);
-            if (error != X509_V_OK)
+            int ctxError = X509_STORE_CTX_get_error(cts);
+            if (ctxError != X509_V_OK)
             {
-                BMCWEB_LOG_INFO << this << " Last TLS error is: " << error;
+                BMCWEB_LOG_INFO << this << " Last TLS error is: " << ctxError;
                 return true;
             }
             // Check that we have reached final certificate in chain
diff --git a/http/http_server.hpp b/http/http_server.hpp
index a0ccc09..050a3f0 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -30,34 +30,34 @@
   public:
     Server(Handler* handlerIn,
            std::unique_ptr<boost::asio::ip::tcp::acceptor>&& acceptorIn,
-           std::shared_ptr<boost::asio::ssl::context> adaptorCtx,
+           std::shared_ptr<boost::asio::ssl::context> adaptorCtxIn,
            std::shared_ptr<boost::asio::io_context> io =
                std::make_shared<boost::asio::io_context>()) :
         ioService(std::move(io)),
         acceptor(std::move(acceptorIn)),
         signals(*ioService, SIGINT, SIGTERM, SIGHUP), handler(handlerIn),
-        adaptorCtx(std::move(adaptorCtx))
+        adaptorCtx(std::move(adaptorCtxIn))
     {}
 
     Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port,
-           const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx,
+           const std::shared_ptr<boost::asio::ssl::context>& adaptorCtxIn,
            const std::shared_ptr<boost::asio::io_context>& io =
                std::make_shared<boost::asio::io_context>()) :
         Server(handlerIn,
                std::make_unique<boost::asio::ip::tcp::acceptor>(
                    *io, boost::asio::ip::tcp::endpoint(
                             boost::asio::ip::make_address(bindaddr), port)),
-               adaptorCtx, io)
+               adaptorCtxIn, io)
     {}
 
     Server(Handler* handlerIn, int existingSocket,
-           const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx,
+           const std::shared_ptr<boost::asio::ssl::context>& adaptorCtxIn,
            const std::shared_ptr<boost::asio::io_context>& io =
                std::make_shared<boost::asio::io_context>()) :
         Server(handlerIn,
                std::make_unique<boost::asio::ip::tcp::acceptor>(
                    *io, boost::asio::ip::tcp::v6(), existingSocket),
-               adaptorCtx, io)
+               adaptorCtxIn, io)
     {}
 
     void updateDateStr()
diff --git a/http/websocket.hpp b/http/websocket.hpp
index 9a735fd..3aa8554 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -70,18 +70,18 @@
   public:
     ConnectionImpl(
         const crow::Request& reqIn, Adaptor adaptorIn,
-        std::function<void(Connection&)> openHandler,
+        std::function<void(Connection&)> openHandlerIn,
         std::function<void(Connection&, const std::string&, bool)>
-            messageHandler,
-        std::function<void(Connection&, const std::string&)> closeHandler,
-        std::function<void(Connection&)> errorHandler) :
+            messageHandlerIn,
+        std::function<void(Connection&, const std::string&)> closeHandlerIn,
+        std::function<void(Connection&)> errorHandlerIn) :
         Connection(reqIn, reqIn.session == nullptr ? std::string{}
                                                    : reqIn.session->username),
         ws(std::move(adaptorIn)), inBuffer(inString, 131088),
-        openHandler(std::move(openHandler)),
-        messageHandler(std::move(messageHandler)),
-        closeHandler(std::move(closeHandler)),
-        errorHandler(std::move(errorHandler)), session(reqIn.session)
+        openHandler(std::move(openHandlerIn)),
+        messageHandler(std::move(messageHandlerIn)),
+        closeHandler(std::move(closeHandlerIn)),
+        errorHandler(std::move(errorHandlerIn)), session(reqIn.session)
     {
         /* Turn on the timeouts on websocket stream to server role */
         ws.set_option(boost::beast::websocket::stream_base::timeout::suggested(
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 7dccbd8..2c6668c 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -439,19 +439,19 @@
 inline Rc Lock::isConflictWithTable(const LockRequests& refLockRequestStructure)
 {
 
-    uint32_t transactionId = 0;
+    uint32_t thisTransactionId = 0;
 
     if (lockTable.empty())
     {
-        transactionId = generateTransactionId();
-        BMCWEB_LOG_DEBUG << transactionId;
+        thisTransactionId = generateTransactionId();
+        BMCWEB_LOG_DEBUG << thisTransactionId;
         // Lock table is empty, so we are safe to add the lockrecords
         // as there will be no conflict
         BMCWEB_LOG_DEBUG << "Lock table is empty, so adding the lockrecords";
         lockTable.emplace(std::pair<uint32_t, LockRequests>(
-            transactionId, refLockRequestStructure));
+            thisTransactionId, refLockRequestStructure));
 
-        return std::make_pair(false, transactionId);
+        return std::make_pair(false, thisTransactionId);
     }
     BMCWEB_LOG_DEBUG
         << "Lock table is not empty, check for conflict with lock table";
@@ -597,7 +597,7 @@
 
         // compare segment data
 
-        for (uint32_t i = 0; i < p.second; i++)
+        for (uint32_t j = 0; j < p.second; j++)
         {
             // if the segment data is different, then the locks is on a
             // different resource so no conflict between the lock
@@ -610,7 +610,7 @@
             if (!(checkByte(
                     boost::endian::endian_reverse(std::get<3>(refLockRecord1)),
                     boost::endian::endian_reverse(std::get<3>(refLockRecord2)),
-                    i)))
+                    j)))
             {
                 return false;
             }
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp
index 945ebf9..9d801da 100644
--- a/include/multipart_parser.hpp
+++ b/include/multipart_parser.hpp
@@ -198,7 +198,7 @@
                         // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
                         c = buffer[i];
                     }
-                    processPartData(prevIndex, index, buffer, i, c, state);
+                    processPartData(prevIndex, buffer, i, c);
                     break;
                 case State::END:
                     break;
@@ -244,8 +244,8 @@
         }
     }
 
-    void processPartData(size_t& prevIndex, size_t& index, const char* buffer,
-                         size_t& i, char c, State& state)
+    void processPartData(size_t& prevIndex, const char* buffer, size_t& i,
+                         char c)
     {
         prevIndex = index;
 
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 1ed695a..7641023 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2168,9 +2168,9 @@
                 const char* ifaceName = interface->Attribute("name");
                 if (ifaceName != nullptr)
                 {
-                    nlohmann::json::object_t interface;
-                    interface["name"] = ifaceName;
-                    interfacesArray.push_back(std::move(interface));
+                    nlohmann::json::object_t interfaceObj;
+                    interfaceObj["name"] = ifaceName;
+                    interfacesArray.push_back(std::move(interfaceObj));
                 }
 
                 interface = interface->NextSiblingElement("interface");
diff --git a/meson.build b/meson.build
index aa0fb3b..2ba0fc2 100644
--- a/meson.build
+++ b/meson.build
@@ -165,6 +165,7 @@
      '-Wunused-parameter',
      '-Wnull-dereference',
      '-Wdouble-promotion',
+     '-Wshadow',
      '-Wno-psabi',
      ]),
     language:'cpp')
diff --git a/redfish-core/include/query.hpp b/redfish-core/include/query.hpp
index 4c7e2f4..df61aef 100644
--- a/redfish-core/include/query.hpp
+++ b/redfish-core/include/query.hpp
@@ -50,8 +50,8 @@
         asyncResp->res.releaseCompleteRequestHandler();
     asyncResp->res.setCompleteRequestHandler(
         [&app, handler(std::move(handler)),
-         query{*queryOpt}](crow::Response& res) mutable {
-        processAllParams(app, query, handler, res);
+         query{*queryOpt}](crow::Response& resIn) mutable {
+        processAllParams(app, query, handler, resIn);
     });
     return true;
 }
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 7282413..e221a86 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -470,9 +470,9 @@
     // allows callers to attach sub-responses within the json tree that need
     // to be executed and filled into their appropriate locations.  This
     // class manages the final "merge" of the json resources.
-    MultiAsyncResp(crow::App& app,
+    MultiAsyncResp(crow::App& appIn,
                    std::shared_ptr<bmcweb::AsyncResp> finalResIn) :
-        app(app),
+        app(appIn),
         finalRes(std::move(finalResIn))
     {}
 
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 724d5f3..cfa1832 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -319,9 +319,9 @@
                         *crow::connections::systemBus, connectionName, path,
                         assetTagInterface, "AssetTag",
                         [asyncResp, chassisId(std::string(chassisId))](
-                            const boost::system::error_code ec,
+                            const boost::system::error_code ec2,
                             const std::string& property) {
-                        if (ec)
+                        if (ec2)
                         {
                             BMCWEB_LOG_DEBUG
                                 << "DBus response error for AssetTag";
@@ -615,11 +615,11 @@
         }
 
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code ec2) {
             // Use "Set" method to set the property value.
-            if (ec)
+            if (ec2)
             {
-                BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec;
+                BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec2;
                 messages::internalError(asyncResp->res);
                 return;
             }
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 7b1d1da..f15fb0b 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1871,8 +1871,8 @@
         // An addition could be a Redfish Setting like
         // ActiveSoftwareImageApplyTime and support OnReset
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2) {
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-Bus response error setting.";
                 messages::internalError(aResp->res);
@@ -2061,9 +2061,9 @@
                             const std::shared_ptr<bmcweb::AsyncResp>& aRsp) {
             aRsp->res.jsonValue["Links"]["ManagerForChassis@odata.count"] = 1;
             nlohmann::json::array_t managerForChassis;
-            nlohmann::json::object_t manager;
-            manager["@odata.id"] = "/redfish/v1/Chassis/" + chassisId;
-            managerForChassis.push_back(std::move(manager));
+            nlohmann::json::object_t managerObj;
+            managerObj["@odata.id"] = "/redfish/v1/Chassis/" + chassisId;
+            managerForChassis.push_back(std::move(managerObj));
             aRsp->res.jsonValue["Links"]["ManagerForChassis"] =
                 std::move(managerForChassis);
             aRsp->res.jsonValue["Links"]["ManagerInChassis"]["@odata.id"] =
@@ -2133,10 +2133,10 @@
                     "xyz.openbmc_project.Inventory.Decorator.Asset")
                 {
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec,
+                        [asyncResp](const boost::system::error_code ec2,
                                     const dbus::utility::DBusPropertiesMap&
                                         propertiesList) {
-                        if (ec)
+                        if (ec2)
                         {
                             BMCWEB_LOG_DEBUG << "Can't get bmc asset!";
                             return;
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index 74636dd..b93483c 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -115,11 +115,11 @@
             sdbusplus::asio::getProperty<telemetry::TimestampReadings>(
                 *crow::connections::systemBus, telemetry::service, reportPath,
                 telemetry::reportInterface, "Readings",
-                [asyncResp, id](const boost::system::error_code ec,
+                [asyncResp, id](const boost::system::error_code ec2,
                                 const telemetry::TimestampReadings& ret) {
-                if (ec)
+                if (ec2)
                 {
-                    BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+                    BMCWEB_LOG_ERROR << "respHandler DBus error " << ec2;
                     messages::internalError(asyncResp->res);
                     return;
                 }
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index 8f45fca..88333fc 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -96,10 +96,11 @@
     }
 
     nlohmann::json metrics = nlohmann::json::array();
-    for (const auto& [sensorPath, operationType, id, metadata] : *readingParams)
+    for (const auto& [sensorPath, operationType, metricId, metadata] :
+         *readingParams)
     {
         metrics.push_back({
-            {"MetricId", id},
+            {"MetricId", metricId},
             {"MetricProperties", {metadata}},
         });
     }
@@ -254,8 +255,8 @@
 {
   public:
     AddReport(AddReportArgs argsIn,
-              const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) :
-        asyncResp(asyncResp),
+              const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) :
+        asyncResp(asyncRespIn),
         args{std::move(argsIn)}
     {}
     ~AddReport()
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 8e921d7..89f0334 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -194,9 +194,9 @@
             asyncResp->res.jsonValue[protocolName]["ProtocolEnabled"] =
                 isProtocolEnabled;
             getPortNumber(socketPath, [asyncResp, protocolName](
-                                          const boost::system::error_code ec,
+                                          const boost::system::error_code ec2,
                                           int portNumber) {
-                if (ec)
+                if (ec2)
                 {
                     messages::internalError(asyncResp->res);
                     return;
@@ -272,8 +272,8 @@
                     }
 
                     crow::connections::systemBus->async_method_call(
-                        [asyncResp](const boost::system::error_code ec) {
-                        if (ec)
+                        [asyncResp](const boost::system::error_code ec2) {
+                        if (ec2)
                         {
                             messages::internalError(asyncResp->res);
                             return;
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 1e04393..a8cfb68 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -581,13 +581,13 @@
                     "xyz.openbmc_project.Inventory.Item.Cpu."
                     "OperatingConfig",
                     "BaseSpeedPrioritySettings",
-                    [aResp](const boost::system::error_code ec,
+                    [aResp](const boost::system::error_code ec2,
                             const BaseSpeedPrioritySettingsProperty&
                                 baseSpeedList) {
-                    if (ec)
+                    if (ec2)
                     {
                         BMCWEB_LOG_WARNING << "D-Bus Property Get error: "
-                                           << ec;
+                                           << ec2;
                         messages::internalError(aResp->res);
                         return;
                     }
@@ -731,7 +731,7 @@
             // matching objects. Assume all interfaces we want to process
             // must be on the same object path.
 
-            handler(resp, processorId, objectPath, serviceMap);
+            handler(objectPath, serviceMap);
             return;
         }
         messages::resourceNotFound(resp->res, "Processor", processorId);
@@ -1218,7 +1218,9 @@
         asyncResp->res.jsonValue["@odata.id"] =
             "/redfish/v1/Systems/system/Processors/" + processorId;
 
-        getProcessorObject(asyncResp, processorId, getProcessorData);
+        getProcessorObject(
+            asyncResp, processorId,
+            std::bind_front(getProcessorData, asyncResp, processorId));
         });
 
     BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Processors/<str>/")
@@ -1249,17 +1251,10 @@
             }
             // Check for 404 and find matching D-Bus object, then run
             // property patch handlers if that all succeeds.
-            getProcessorObject(
-                asyncResp, processorId,
-                [appliedConfigUri = std::move(appliedConfigUri)](
-                    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                    const std::string& processorId,
-                    const std::string& objectPath,
-                    const dbus::utility::MapperServiceMap& serviceMap) {
-                patchAppliedOperatingConfig(asyncResp, processorId,
-                                            appliedConfigUri, objectPath,
-                                            serviceMap);
-                });
+            getProcessorObject(asyncResp, processorId,
+                               std::bind_front(patchAppliedOperatingConfig,
+                                               asyncResp, processorId,
+                                               appliedConfigUri));
         }
         });
 }
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 09e21e8..ca842d9 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -192,35 +192,35 @@
         const std::string dbusPath;
     };
 
-    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
                      const std::string& chassisIdIn,
                      std::span<std::string_view> typesIn,
                      std::string_view subNode) :
-        asyncResp(asyncResp),
+        asyncResp(asyncRespIn),
         chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode),
         efficientExpand(false)
     {}
 
     // Store extra data about sensor mapping and return it in callback
-    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
                      const std::string& chassisIdIn,
                      std::span<std::string_view> typesIn,
                      std::string_view subNode,
                      DataCompleteCb&& creationComplete) :
-        asyncResp(asyncResp),
+        asyncResp(asyncRespIn),
         chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode),
         efficientExpand(false), metadata{std::vector<SensorData>()},
         dataComplete{std::move(creationComplete)}
     {}
 
     // sensor collections expand
-    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
                      const std::string& chassisIdIn,
                      const std::span<std::string_view> typesIn,
-                     const std::string_view& subNode, bool efficientExpand) :
-        asyncResp(asyncResp),
+                     const std::string_view& subNode, bool efficientExpandIn) :
+        asyncResp(asyncRespIn),
         chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode),
-        efficientExpand(efficientExpand)
+        efficientExpand(efficientExpandIn)
     {}
 
     ~SensorsAsyncResp()
@@ -1249,8 +1249,8 @@
                         sensorsAsyncResp->asyncResp->res.jsonValue["Fans"];
                     for (const std::string& item : *collection)
                     {
-                        sdbusplus::message::object_path path(item);
-                        std::string itemName = path.filename();
+                        sdbusplus::message::object_path itemPath(item);
+                        std::string itemName = itemPath.filename();
                         if (itemName.empty())
                         {
                             continue;
@@ -1266,11 +1266,11 @@
                             });
                         if (schemaItem != fanRedfish.end())
                         {
-                            nlohmann::json::object_t collection;
-                            collection["@odata.id"] =
+                            nlohmann::json::object_t collectionId;
+                            collectionId["@odata.id"] =
                                 (*schemaItem)["@odata.id"];
                             redfishCollection.emplace_back(
-                                std::move(collection));
+                                std::move(collectionId));
                         }
                         else
                         {
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index ecdf8b2..cab23a2 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -184,7 +184,7 @@
                     // Redfish properties with same name and a
                     // string value
                     const std::string& propertyName = property.first;
-                    nlohmann::json& object =
+                    nlohmann::json& controller =
                         asyncResp->res.jsonValue["StorageControllers"][index];
                     if ((propertyName == "PartNumber") ||
                         (propertyName == "SerialNumber") ||
@@ -199,7 +199,7 @@
                             messages::internalError(asyncResp->res);
                             return;
                         }
-                        object[propertyName] = *value;
+                        controller[propertyName] = *value;
                     }
                 }
                 },
@@ -650,8 +650,8 @@
                 std::vector<std::string> leafNames;
                 for (const auto& drive : resp)
                 {
-                    sdbusplus::message::object_path path(drive);
-                    leafNames.push_back(path.filename());
+                    sdbusplus::message::object_path drivePath(drive);
+                    leafNames.push_back(drivePath.filename());
                 }
 
                 std::sort(leafNames.begin(), leafNames.end(),
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 0e00341..7180b09 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1246,11 +1246,11 @@
         sdbusplus::asio::getProperty<bool>(
             *crow::connections::systemBus, serv, path,
             "xyz.openbmc_project.Control.TPM.Policy", "TPMEnable",
-            [aResp](const boost::system::error_code ec, bool tpmRequired) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2, bool tpmRequired) {
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get"
-                                 << ec;
+                                 << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -1336,12 +1336,12 @@
 
         // Valid TPM Enable object found, now setting the value
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2) {
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG
                     << "DBUS response error: Set TrustedModuleRequiredToBoot"
-                    << ec;
+                    << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -1468,10 +1468,10 @@
     BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable;
 
     crow::connections::systemBus->async_method_call(
-        [aResp](const boost::system::error_code ec) {
-        if (ec)
+        [aResp](const boost::system::error_code ec2) {
+        if (ec2)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
             messages::internalError(aResp->res);
             return;
         }
@@ -1942,12 +1942,12 @@
         sdbusplus::asio::getProperty<std::string>(
             *crow::connections::systemBus, service, path,
             "xyz.openbmc_project.Control.Power.Mode", "PowerMode",
-            [aResp](const boost::system::error_code ec,
+            [aResp](const boost::system::error_code ec2,
                     const std::string& pmode) {
-            if (ec)
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error on PowerMode Get: "
-                                 << ec;
+                                 << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -2069,8 +2069,8 @@
 
         // Set the Power Mode property
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec) {
-            if (ec)
+            [aResp](const boost::system::error_code ec2) {
+            if (ec2)
             {
                 messages::internalError(aResp->res);
                 return;
@@ -2419,12 +2419,12 @@
 
         // Valid IdlePowerSaver object found, now read the current values
         crow::connections::systemBus->async_method_call(
-            [aResp](const boost::system::error_code ec,
+            [aResp](const boost::system::error_code ec2,
                     ipsPropertiesType& properties) {
-            if (ec)
+            if (ec2)
             {
                 BMCWEB_LOG_ERROR
-                    << "DBUS response error on IdlePowerSaver GetAll: " << ec;
+                    << "DBUS response error on IdlePowerSaver GetAll: " << ec2;
                 messages::internalError(aResp->res);
                 return;
             }
@@ -2522,10 +2522,10 @@
         if (ipsEnable)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2537,10 +2537,10 @@
         if (ipsEnterUtil)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2555,10 +2555,10 @@
             // Convert from seconds into milliseconds for DBus
             const uint64_t timeMilliseconds = *ipsEnterTime * 1000;
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2571,10 +2571,10 @@
         if (ipsExitUtil)
         {
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2589,10 +2589,10 @@
             // Convert from seconds into milliseconds for DBus
             const uint64_t timeMilliseconds = *ipsExitTime * 1000;
             crow::connections::systemBus->async_method_call(
-                [aResp](const boost::system::error_code ec) {
-                if (ec)
+                [aResp](const boost::system::error_code ec2) {
+                if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
                     messages::internalError(aResp->res);
                     return;
                 }
@@ -2636,7 +2636,7 @@
             *crow::connections::systemBus, "xyz.openbmc_project.Settings",
             "/xyz/openbmc_project/network/hypervisor",
             "xyz.openbmc_project.Network.SystemConfiguration", "HostName",
-            [asyncResp](const boost::system::error_code ec,
+            [asyncResp](const boost::system::error_code ec2,
                         const std::string& /*hostName*/) {
             nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
             ifaceArray = nlohmann::json::array();
@@ -2646,7 +2646,7 @@
             system["@odata.id"] = "/redfish/v1/Systems/system";
             ifaceArray.push_back(std::move(system));
             count = ifaceArray.size();
-            if (!ec)
+            if (!ec2)
             {
                 BMCWEB_LOG_DEBUG << "Hypervisor is available";
                 nlohmann::json::object_t hypervisor;
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 33769a0..c9fb4a1 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -141,10 +141,10 @@
                             {
                                 if (property.first == "Activation")
                                 {
-                                    const std::string* state =
+                                    const std::string* activationState =
                                         std::get_if<std::string>(
                                             &property.second);
-                                    if (state == nullptr)
+                                    if (activationState == nullptr)
                                     {
                                         taskData->messages.emplace_back(
                                             messages::internalError());
@@ -201,10 +201,10 @@
                             {
                                 if (property.first == "Progress")
                                 {
-                                    const std::string* progress =
+                                    const std::string* progressStr =
                                         std::get_if<std::string>(
                                             &property.second);
-                                    if (progress == nullptr)
+                                    if (progressStr == nullptr)
                                     {
                                         taskData->messages.emplace_back(
                                             messages::internalError());
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index aba98e95..4f6fad9 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -54,10 +54,10 @@
  * @brief Read all known properties from VM object interfaces
  */
 inline void
-    vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interface,
+    vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interfaces,
                            const std::shared_ptr<bmcweb::AsyncResp>& aResp)
 {
-    for (const auto& [interface, values] : interface)
+    for (const auto& [interface, values] : interfaces)
     {
         if (interface == "xyz.openbmc_project.VirtualMedia.MountPoint")
         {
@@ -595,8 +595,8 @@
   public:
     using unix_fd = sdbusplus::message::unix_fd;
 
-    Pipe(boost::asio::io_context& io, Buffer&& buffer) :
-        impl(io), buffer{std::move(buffer)}
+    Pipe(boost::asio::io_context& io, Buffer&& bufferIn) :
+        impl(io), buffer{std::move(bufferIn)}
     {}
 
     ~Pipe()
@@ -830,9 +830,9 @@
 
         crow::connections::systemBus->async_method_call(
             [service, resName, actionParams,
-             asyncResp](const boost::system::error_code ec,
+             asyncResp](const boost::system::error_code ec2,
                         dbus::utility::ManagedObjectType& subtree) mutable {
-            if (ec)
+            if (ec2)
             {
                 BMCWEB_LOG_DEBUG << "DBUS response error";
 
@@ -915,11 +915,11 @@
 
     crow::connections::systemBus->async_method_call(
         [asyncResp,
-         resName](const boost::system::error_code ec,
+         resName](const boost::system::error_code ec2,
                   const dbus::utility::MapperGetObject& getObjectType) {
-        if (ec)
+        if (ec2)
         {
-            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec2;
             messages::internalError(asyncResp->res);
 
             return;