remove unnecessary std::move calls
GCC 13 now flags a std::move of an returned temporary as unnecessary and
likely preventing RVO. Remove the unnecessary std::move.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ibde052b5a4efd84bdbbac2f2f6e673729b32e6cd
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index 7389e3a..89ecab4 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -1132,8 +1132,8 @@
auto changed = recordManager->add(data);
if (changed)
{
- average->values(std::move(recordManager->getAverageRecords()));
- maximum->values(std::move(recordManager->getMaximumRecords()));
+ average->values(recordManager->getAverageRecords());
+ maximum->values(recordManager->getMaximumRecords());
}
}
diff --git a/phosphor-regulators/test/device_tests.cpp b/phosphor-regulators/test/device_tests.cpp
index d5fdf74..5aaa2fe 100644
--- a/phosphor-regulators/test/device_tests.cpp
+++ b/phosphor-regulators/test/device_tests.cpp
@@ -180,7 +180,7 @@
Device device{"vdd_reg",
false,
deviceInvPath,
- std::move(createI2CInterface()),
+ createI2CInterface(),
std::move(presenceDetection),
std::move(configuration),
std::move(phaseFaultDetection),
@@ -205,8 +205,7 @@
// Test where Device does not contain a PresenceDetection object
try
{
- Device device{"vdd_reg", false, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", false, deviceInvPath, createI2CInterface()};
device.clearCache();
}
catch (...)
@@ -686,8 +685,7 @@
{
// Test where Configuration was not specified in constructor
{
- Device device{"vdd_reg", true, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", true, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.getConfiguration(), nullptr);
}
@@ -707,7 +705,7 @@
Device device{"vdd_reg",
true,
deviceInvPath,
- std::move(createI2CInterface()),
+ createI2CInterface(),
std::move(presenceDetection),
std::move(configuration)};
EXPECT_NE(device.getConfiguration(), nullptr);
@@ -719,8 +717,7 @@
TEST_F(DeviceTests, GetFRU)
{
- Device device{"vdd_reg", true, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", true, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.getFRU(), deviceInvPath);
}
@@ -734,8 +731,7 @@
TEST_F(DeviceTests, GetID)
{
- Device device{"vdd_reg", false, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", false, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.getID(), "vdd_reg");
}
@@ -743,8 +739,7 @@
{
// Test where PhaseFaultDetection was not specified in constructor
{
- Device device{"vdd_reg", true, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", true, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.getPhaseFaultDetection(), nullptr);
}
@@ -762,7 +757,7 @@
Device device{"vdd_reg",
false,
deviceInvPath,
- std::move(createI2CInterface()),
+ createI2CInterface(),
std::move(presenceDetection),
std::move(configuration),
std::move(phaseFaultDetection)};
@@ -775,8 +770,7 @@
{
// Test where PresenceDetection was not specified in constructor
{
- Device device{"vdd_reg", true, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", true, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.getPresenceDetection(), nullptr);
}
@@ -789,8 +783,7 @@
std::make_unique<PresenceDetection>(std::move(actions));
// Create Device
- Device device{"vdd_reg", false, deviceInvPath,
- std::move(createI2CInterface()),
+ Device device{"vdd_reg", false, deviceInvPath, createI2CInterface(),
std::move(presenceDetection)};
EXPECT_NE(device.getPresenceDetection(), nullptr);
EXPECT_EQ(device.getPresenceDetection()->getActions().size(), 1);
@@ -801,8 +794,7 @@
{
// Test where no rails were specified in constructor
{
- Device device{"vdd_reg", true, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", true, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.getRails().size(), 0);
}
@@ -821,7 +813,7 @@
Device device{"vdd_reg",
false,
deviceInvPath,
- std::move(createI2CInterface()),
+ createI2CInterface(),
std::move(presenceDetection),
std::move(configuration),
std::move(phaseFaultDetection),
@@ -894,8 +886,7 @@
TEST_F(DeviceTests, IsRegulator)
{
- Device device{"vdd_reg", false, deviceInvPath,
- std::move(createI2CInterface())};
+ Device device{"vdd_reg", false, deviceInvPath, createI2CInterface()};
EXPECT_EQ(device.isRegulator(), false);
}
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 1dc383d..604e1b3 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -741,8 +741,8 @@
auto changed = recordManager->add(data);
if (changed)
{
- average->values(std::move(recordManager->getAverageRecords()));
- maximum->values(std::move(recordManager->getMaximumRecords()));
+ average->values(recordManager->getAverageRecords());
+ maximum->values(recordManager->getMaximumRecords());
}
}