Turn on a bunch of warnings
Turn on as many warnings as I could easily from:
https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100
Tested: sensor list still the same
Change-Id: Ie7c56282e6a590a339554b40017b92020dd939f1
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 1832fb1..c6e22ef 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -181,9 +181,9 @@
{
connection->async_method_call(
[conn,
- interface](boost::system::error_code& ec,
+ interface](boost::system::error_code& errc,
const ManagedObjectType& managedInterface) {
- if (ec)
+ if (errc)
{
std::cerr
<< "error getting managed object for device "
@@ -246,12 +246,12 @@
case nlohmann::json::value_t::string:
{
std::regex search(match.second.get<std::string>());
- std::smatch match;
+ std::smatch regMatch;
// convert value to string respresentation
std::string probeValue = std::visit(
VariantToStringVisitor(), deviceValue->second);
- if (!std::regex_search(probeValue, match, search))
+ if (!std::regex_search(probeValue, regMatch, search))
{
deviceMatches = false;
break;
@@ -484,8 +484,6 @@
void run()
{
// parse out dbus probes by discarding other probe types
- boost::container::flat_map<const char*, probe_type_codes,
- cmp_str>::const_iterator probeType;
for (std::string& probe : _probeCommand)
{
@@ -543,7 +541,7 @@
ref = value;
return true;
}
- catch (const std::out_of_range)
+ catch (const std::out_of_range&)
{
return false;
}
@@ -639,16 +637,16 @@
iface->register_method(
"Delete", [&objServer, &systemConfiguration, interface,
jsonPointerPath{std::string(jsonPointerPath)}]() {
- std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
+ std::shared_ptr<sdbusplus::asio::dbus_interface> dbusInterface =
interface.lock();
- if (!iface)
+ if (!dbusInterface)
{
// this technically can't happen as the pointer is pointing to
// us
throw DBusInternalError();
}
nlohmann::json::json_pointer ptr(jsonPointerPath);
- if (!objServer.remove_interface(iface))
+ if (!objServer.remove_interface(dbusInterface))
{
std::cerr << "Can't delete interface " << jsonPointerPath
<< "\n";
@@ -925,7 +923,7 @@
std::regex_replace(dbusName.begin(), dbusName.begin(),
dbusName.end(), ILLEGAL_DBUS_MEMBER_REGEX, "_");
- auto iface = objServer.add_interface(
+ auto interface = objServer.add_interface(
path + "/" + dbusName,
"xyz.openbmc_project.Configuration." + *type);
// permission is read-write, as since we just created it, must be
@@ -933,7 +931,7 @@
populateInterfaceFromJson(
systemConfiguration,
jsonPointerPath + "/Exposes/" + std::to_string(lastIndex),
- iface, newData, objServer,
+ interface, newData, objServer,
sdbusplus::asio::PropertyPermission::readWrite);
});
iface->initialize();
@@ -1317,10 +1315,10 @@
keyPair.value() = static_cast<uint64_t>(temp);
}
}
- catch (std::invalid_argument)
+ catch (std::invalid_argument&)
{
}
- catch (std::out_of_range)
+ catch (std::out_of_range&)
{
}
}
@@ -1650,7 +1648,6 @@
};
void startRemovedTimer(boost::asio::deadline_timer& timer,
- std::vector<sdbusplus::bus::match::match>& dbusMatches,
nlohmann::json& systemConfiguration)
{
static bool scannedPowerOff = false;
@@ -1789,8 +1786,7 @@
objServer);
if (!timerRunning)
{
- startRemovedTimer(timer, dbusMatches,
- systemConfiguration);
+ startRemovedTimer(timer, systemConfiguration);
}
});
});
@@ -1830,7 +1826,7 @@
}
}
-int main(int argc, char** argv)
+int main()
{
// setup connection to dbus
boost::asio::io_service io;
@@ -1857,8 +1853,9 @@
"Notify",
[](const boost::container::flat_map<
std::string,
- boost::container::flat_map<std::string, BasicVariantType>>&
- object) { return; });
+ boost::container::flat_map<std::string, BasicVariantType>>&) {
+ return;
+ });
inventoryIface->initialize();
io.post([&]() {