build: enable and fix -Wshadow
Shadow names can be prone to bugs. Enable the warning to avoid them in
the future. Tested by building and running the unit tests.
Change-Id: Ic3227675f4ff40d266ae2a60c66c894f16e5888e
Signed-off-by: Brad Bishop <bradbish@qti.qualcomm.com>
diff --git a/src/associations.cpp b/src/associations.cpp
index 3293b4e..880b382 100644
--- a/src/associations.cpp
+++ b/src/associations.cpp
@@ -467,7 +467,7 @@
addSingleAssociation(io, server, assocPath, endpointPath, owner,
ownerPath, assocMaps);
}
- catch (const sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& ex)
{
// In some case the interface could not be created on DBus and an
// exception is thrown. mapper has no control of the interface/path
@@ -475,7 +475,7 @@
// association request.
std::cerr << "Error adding association: assocPath " << assocPath
<< ", endpointPath " << endpointPath
- << ", what: " << e.what() << "\n";
+ << ", what: " << ex.what() << "\n";
}
// Not pending anymore
@@ -515,10 +515,11 @@
auto a = std::find_if(
assocs.begin(), assocs.end(),
[&endpointPath, &otherPath](const auto& ap) {
- const auto& endpoints = ap.second;
- auto endpoint = std::find(
- endpoints.begin(), endpoints.end(), otherPath);
- if (endpoint != endpoints.end())
+ const auto& otherEndpoints = ap.second;
+ auto endpoint =
+ std::find(otherEndpoints.begin(),
+ otherEndpoints.end(), otherPath);
+ if (endpoint != otherEndpoints.end())
{
return ap.first.starts_with(endpointPath + '/');
}