diff options
author | Ed Tanous <edtanous@google.com> | 2022-01-06 23:44:41 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-01-12 21:32:14 +0300 |
commit | f94c4ecf9cf61b91b552731e4e03cd84c1070972 (patch) | |
tree | 445183e7954963ab13afc255845237d5567aab53 /redfish-core/lib | |
parent | cd5e430908916fad4cb9dcabf577cace2dca1cc5 (diff) | |
download | bmcweb-f94c4ecf9cf61b91b552731e4e03cd84c1070972.tar.xz |
Enable clang-tidy forward reference checks
Clang-13 adds new checks we can turn on, which find quite a few errors.
Tested: Code compiles
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I74b780760014c898cc440b37aea640b33e91c439
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 5 | ||||
-rw-r--r-- | redfish-core/lib/hypervisor_system.hpp | 3 | ||||
-rw-r--r-- | redfish-core/lib/network_protocol.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/redfish_util.hpp | 8 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 37 |
5 files changed, 33 insertions, 22 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 049f9a6d53..87351782de 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -931,7 +931,8 @@ void getEthernetIfaceData(const std::string& ethifaceId, CallbackFunc&& callback) { crow::connections::systemBus->async_method_call( - [ethifaceId{std::string{ethifaceId}}, callback{std::move(callback)}]( + [ethifaceId{std::string{ethifaceId}}, + callback{std::forward<CallbackFunc>(callback)}]( const boost::system::error_code errorCode, dbus::utility::ManagedObjectType& resp) { EthernetInterfaceData ethData{}; @@ -982,7 +983,7 @@ template <typename CallbackFunc> void getEthernetIfaceList(CallbackFunc&& callback) { crow::connections::systemBus->async_method_call( - [callback{std::move(callback)}]( + [callback{std::forward<CallbackFunc>(callback)}]( const boost::system::error_code errorCode, dbus::utility::ManagedObjectType& resp) { // Callback requires vector<string> to retrieve all available diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp index 8faae3f976..db9b5aaa7b 100644 --- a/redfish-core/lib/hypervisor_system.hpp +++ b/redfish-core/lib/hypervisor_system.hpp @@ -317,7 +317,8 @@ void getHypervisorIfaceData(const std::string& ethIfaceId, CallbackFunc&& callback) { crow::connections::systemBus->async_method_call( - [ethIfaceId{std::string{ethIfaceId}}, callback{std::move(callback)}]( + [ethIfaceId{std::string{ethIfaceId}}, + callback{std::forward<CallbackFunc>(callback)}]( const boost::system::error_code error, const dbus::utility::ManagedObjectType& resp) { EthernetInterfaceData ethData{}; diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index c19bef59ea..41b14f83c3 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -82,7 +82,7 @@ template <typename CallbackFunc> void getEthernetIfaceData(CallbackFunc&& callback) { crow::connections::systemBus->async_method_call( - [callback{std::move(callback)}]( + [callback{std::forward<CallbackFunc>(callback)}]( const boost::system::error_code errorCode, const dbus::utility::ManagedObjectType& dbusData) { std::vector<std::string> ntpServers; diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp index b631f91ec8..881bf1ab7d 100644 --- a/redfish-core/lib/redfish_util.hpp +++ b/redfish-core/lib/redfish_util.hpp @@ -94,9 +94,9 @@ void getPortStatusAndPath(const std::string& serviceName, CallbackFunc&& callback) { crow::connections::systemBus->async_method_call( - [serviceName, - callback{std::move(callback)}](const boost::system::error_code ec, - const std::vector<UnitStruct>& r) { + [serviceName, callback{std::forward<CallbackFunc>(callback)}]( + const boost::system::error_code ec, + const std::vector<UnitStruct>& r) { if (ec) { BMCWEB_LOG_ERROR << ec; @@ -174,7 +174,7 @@ void getPortNumber(const std::string& socketPath, CallbackFunc&& callback) std::vector<std::tuple<std::string, std::string>>>( *crow::connections::systemBus, "org.freedesktop.systemd1", socketPath, "org.freedesktop.systemd1.Socket", "Listen", - [callback{std::move(callback)}]( + [callback{std::forward<CallbackFunc>(callback)}]( const boost::system::error_code ec, const std::vector<std::tuple<std::string, std::string>>& resp) { if (ec) diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index de0a82843f..6d10bb728a 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -327,7 +327,8 @@ void getObjectsWithConnection( "xyz.openbmc_project.Sensor.Value"}; // Response handler for parsing objects subtree - auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp, + auto respHandler = [callback{std::forward<Callback>(callback)}, + sensorsAsyncResp, sensorNames](const boost::system::error_code ec, const GetSubTreeType& subtree) { BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter"; @@ -466,7 +467,7 @@ void getValidChassisPath(const std::shared_ptr<SensorsAsyncResp>& asyncResp, "xyz.openbmc_project.Inventory.Item.Chassis"}; auto respHandler = - [callback{std::move(callback)}, + [callback{std::forward<Callback>(callback)}, asyncResp](const boost::system::error_code ec, const std::vector<std::string>& chassisPaths) mutable { BMCWEB_LOG_DEBUG << "getValidChassisPath respHandler enter"; @@ -520,7 +521,8 @@ void getChassis(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp, const std::array<const char*, 2> interfaces = { "xyz.openbmc_project.Inventory.Item.Board", "xyz.openbmc_project.Inventory.Item.Chassis"}; - auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp]( + auto respHandler = [callback{std::forward<Callback>(callback)}, + sensorsAsyncResp]( const boost::system::error_code ec, const std::vector<std::string>& chassisPaths) { BMCWEB_LOG_DEBUG << "getChassis respHandler enter"; @@ -596,7 +598,8 @@ void getChassis(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp, sdbusplus::asio::getProperty<std::vector<std::string>>( *crow::connections::systemBus, "xyz.openbmc_project.ObjectMapper", sensorPath, "xyz.openbmc_project.Association", "endpoints", - [sensorsAsyncResp, callback{std::move(callback)}]( + [sensorsAsyncResp, + callback{std::forward<const Callback>(callback)}]( const boost::system::error_code& e, const std::vector<std::string>& nodeSensorList) { if (e) @@ -653,7 +656,7 @@ void getObjectManagerPaths( "org.freedesktop.DBus.ObjectManager"}; // Response handler for GetSubTree DBus method - auto respHandler = [callback{std::move(callback)}, + auto respHandler = [callback{std::forward<Callback>(callback)}, sensorsAsyncResp](const boost::system::error_code ec, const GetSubTreeType& subtree) { BMCWEB_LOG_DEBUG << "getObjectManagerPaths respHandler enter"; @@ -1602,7 +1605,8 @@ static void getInventoryItemsData( // Response handler for GetManagedObjects auto respHandler = [sensorsAsyncResp, inventoryItems, invConnections, - objectMgrPaths, callback{std::move(callback)}, + objectMgrPaths, + callback{std::forward<Callback>(callback)}, invConnectionsIndex]( const boost::system::error_code ec, dbus::utility::ManagedObjectType& resp) { @@ -1691,7 +1695,8 @@ static void getInventoryItemsConnections( "xyz.openbmc_project.State.Decorator.OperationalStatus"}; // Response handler for parsing output from GetSubTree - auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp, + auto respHandler = [callback{std::forward<Callback>(callback)}, + sensorsAsyncResp, inventoryItems](const boost::system::error_code ec, const GetSubTreeType& subtree) { BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler enter"; @@ -1773,7 +1778,8 @@ static void getInventoryItemAssociations( BMCWEB_LOG_DEBUG << "getInventoryItemAssociations enter"; // Response handler for GetManagedObjects - auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp, + auto respHandler = [callback{std::forward<Callback>(callback)}, + sensorsAsyncResp, sensorNames](const boost::system::error_code ec, dbus::utility::ManagedObjectType& resp) { BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler enter"; @@ -1955,7 +1961,7 @@ void getInventoryLedData( // Response handler for Get State property auto respHandler = [sensorsAsyncResp, inventoryItems, ledConnections, ledPath, - callback{std::move(callback)}, ledConnectionsIndex]( + callback{std::forward<Callback>(callback)}, ledConnectionsIndex]( const boost::system::error_code ec, const std::string& state) { BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler enter"; if (ec) @@ -2044,7 +2050,8 @@ void getInventoryLeds( "xyz.openbmc_project.Led.Physical"}; // Response handler for parsing output from GetSubTree - auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp, + auto respHandler = [callback{std::forward<Callback>(callback)}, + sensorsAsyncResp, inventoryItems](const boost::system::error_code ec, const GetSubTreeType& subtree) { BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler enter"; @@ -2141,7 +2148,7 @@ void getPowerSupplyAttributesData( // Response handler for Get DeratingFactor property auto respHandler = [sensorsAsyncResp, inventoryItems, - callback{std::move(callback)}]( + callback{std::forward<Callback>(callback)}]( const boost::system::error_code ec, const uint32_t value) { BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler enter"; @@ -2221,7 +2228,8 @@ void getPowerSupplyAttributes( "xyz.openbmc_project.Control.PowerSupplyAttributes"}; // Response handler for parsing output from GetSubTree - auto respHandler = [callback{std::move(callback)}, sensorsAsyncResp, + auto respHandler = [callback{std::forward<Callback>(callback)}, + sensorsAsyncResp, inventoryItems](const boost::system::error_code ec, const GetSubTreeType& subtree) { BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter"; @@ -2313,12 +2321,13 @@ static void getInventoryItems( { BMCWEB_LOG_DEBUG << "getInventoryItems enter"; auto getInventoryItemAssociationsCb = - [sensorsAsyncResp, objectMgrPaths, callback{std::move(callback)}]( + [sensorsAsyncResp, objectMgrPaths, + callback{std::forward<Callback>(callback)}]( std::shared_ptr<std::vector<InventoryItem>> inventoryItems) { BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb enter"; auto getInventoryItemsConnectionsCb = [sensorsAsyncResp, inventoryItems, objectMgrPaths, - callback{std::move(callback)}]( + callback{std::forward<const Callback>(callback)}]( std::shared_ptr<boost::container::flat_set<std::string>> invConnections) { BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb enter"; |