pldm: Drop pessimizing moves
Fixes issues such as:
```
../host-bmc/host_pdr_handler.cpp:684:9: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
684 | std::move(std::vector<uint8_t>(1, PLDM_PDR_ENTITY_ASSOCIATION)),
| ^
../host-bmc/host_pdr_handler.cpp:684:9: note: remove std::move call here
684 | std::move(std::vector<uint8_t>(1, PLDM_PDR_ENTITY_ASSOCIATION)),
| ^~~~~~~~~~ ~
```
Change-Id: Id26f0d6fc21837e1eb76ae3c294c222782a4e69f
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index 49b6326..50456eb 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -57,7 +57,7 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_REQUEST_UPDATE, std::move(request),
- std::move(std::bind_front(&DeviceUpdater::requestUpdate, this)));
+ std::bind_front(&DeviceUpdater::requestUpdate, this));
if (rc)
{
// Handle error scenario
@@ -186,7 +186,7 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_PASS_COMPONENT_TABLE,
std::move(request),
- std::move(std::bind_front(&DeviceUpdater::passCompTable, this)));
+ std::bind_front(&DeviceUpdater::passCompTable, this));
if (rc)
{
// Handle error scenario
@@ -317,7 +317,7 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_UPDATE_COMPONENT, std::move(request),
- std::move(std::bind_front(&DeviceUpdater::updateComponent, this)));
+ std::bind_front(&DeviceUpdater::updateComponent, this));
if (rc)
{
// Handle error scenario
@@ -669,7 +669,7 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_ACTIVATE_FIRMWARE, std::move(request),
- std::move(std::bind_front(&DeviceUpdater::activateFirmware, this)));
+ std::bind_front(&DeviceUpdater::activateFirmware, this));
if (rc)
{
error(
diff --git a/fw-update/inventory_manager.cpp b/fw-update/inventory_manager.cpp
index f341f28..b466984 100644
--- a/fw-update/inventory_manager.cpp
+++ b/fw-update/inventory_manager.cpp
@@ -37,8 +37,7 @@
rc = handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_QUERY_DEVICE_IDENTIFIERS,
std::move(requestMsg),
- std::move(std::bind_front(&InventoryManager::queryDeviceIdentifiers,
- this)));
+ std::bind_front(&InventoryManager::queryDeviceIdentifiers, this));
if (rc)
{
error(
@@ -170,8 +169,7 @@
rc = handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_GET_FIRMWARE_PARAMETERS,
std::move(requestMsg),
- std::move(
- std::bind_front(&InventoryManager::getFirmwareParameters, this)));
+ std::bind_front(&InventoryManager::getFirmwareParameters, this));
if (rc)
{
error(
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index 3621f92..dee768e 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -194,7 +194,7 @@
rc = handler->registerRequest(
mctp_eid, instanceId, PLDM_PLATFORM, PLDM_GET_PDR,
std::move(requestMsg),
- std::move(std::bind_front(&HostPDRHandler::processHostPDRs, this)));
+ std::bind_front(&HostPDRHandler::processHostPDRs, this));
if (rc)
{
error(
@@ -679,7 +679,7 @@
{
deferredPDRRepoChgEvent.reset();
this->sendPDRRepositoryChgEvent(
- std::move(std::vector<uint8_t>(1, PLDM_PDR_ENTITY_ASSOCIATION)),
+ std::vector<uint8_t>(1, PLDM_PDR_ENTITY_ASSOCIATION),
FORMAT_IS_PDR_HANDLES);
}
diff --git a/oem/ibm/libpldmresponder/file_table.cpp b/oem/ibm/libpldmresponder/file_table.cpp
index d0b06bc..d91c482 100644
--- a/oem/ibm/libpldmresponder/file_table.cpp
+++ b/oem/ibm/libpldmresponder/file_table.cpp
@@ -134,7 +134,7 @@
static FileTable table;
if (table.isEmpty())
{
- table = std::move(FileTable(fileTablePath));
+ table = FileTable(fileTablePath);
}
return table;
}
diff --git a/requester/test/handler_test.cpp b/requester/test/handler_test.cpp
index 4ac7861..19afdd1 100644
--- a/requester/test/handler_test.cpp
+++ b/requester/test/handler_test.cpp
@@ -83,7 +83,7 @@
EXPECT_EQ(instanceId, 0);
auto rc = reqHandler.registerRequest(
eid, instanceId, 0, 0, std::move(request),
- std::move(std::bind_front(&HandlerTest::pldmResponseCallBack, this)));
+ std::bind_front(&HandlerTest::pldmResponseCallBack, this));
EXPECT_EQ(rc, PLDM_SUCCESS);
pldm::Response response(sizeof(pldm_msg_hdr) + sizeof(uint8_t));
@@ -104,7 +104,7 @@
EXPECT_EQ(instanceId, 0);
auto rc = reqHandler.registerRequest(
eid, instanceId, 0, 0, std::move(request),
- std::move(std::bind_front(&HandlerTest::pldmResponseCallBack, this)));
+ std::bind_front(&HandlerTest::pldmResponseCallBack, this));
EXPECT_EQ(rc, PLDM_SUCCESS);
// Waiting for 500ms so that the instance ID expiry callback is invoked
@@ -123,7 +123,7 @@
EXPECT_EQ(instanceId, 0);
auto rc = reqHandler.registerRequest(
eid, instanceId, 0, 0, std::move(request),
- std::move(std::bind_front(&HandlerTest::pldmResponseCallBack, this)));
+ std::bind_front(&HandlerTest::pldmResponseCallBack, this));
EXPECT_EQ(rc, PLDM_SUCCESS);
pldm::Request requestNxt{};
@@ -131,7 +131,7 @@
EXPECT_EQ(instanceIdNxt, 1);
rc = reqHandler.registerRequest(
eid, instanceIdNxt, 0, 0, std::move(requestNxt),
- std::move(std::bind_front(&HandlerTest::pldmResponseCallBack, this)));
+ std::bind_front(&HandlerTest::pldmResponseCallBack, this));
EXPECT_EQ(rc, PLDM_SUCCESS);
pldm::Response response(sizeof(pldm_msg_hdr) + sizeof(uint8_t));