clang-tidy: Suppress pessimizing-move warning
This commit introduces a temporary fix to suppress the
"moving a temporary object prevents copy elision" warning
using pragma directives. This is necessary to support the
ongoing Clang-Tidy migration.
'''
power-supply/record_manager.cpp:83:28:
error: moving a temporary object prevents copy elision [-Werror
1m/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:552:2:
error: 'result_of<(lambda at ../power-supply/power_supply.cpp:50:31) &()>' is deprecated: use 'std::invoke_result' instead [-Werror
1m/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:552:2:
error: 'result_of<(lambda at ../power-supply/power_supply.cpp:62:31) &()>' is deprecated: use 'std::invoke_result' instead [-Werror
'''
Changes:
- Added pragma directives to suppress the -Wpessimizing-move warning
in specific code sections.
Tested: Build and unit testing verified.
Change-Id: I464674a5da5992368627a6b2f54fabc65c402aea
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 6ebf3a9..66d2d94 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -41,6 +41,10 @@
using namespace sdbusplus::org::open_power::Witherspoon::Fault::Error;
using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpessimizing-move"
+#endif
PowerSupply::PowerSupply(const std::string& name, size_t inst,
const std::string& objpath, const std::string& invpath,
sdbusplus::bus_t& bus, const sdeventplus::Event& e,
@@ -98,6 +102,9 @@
// Get initial power state.
updatePowerState();
}
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
void PowerSupply::getAccessType()
{