Fix build issues after migrating to Clang 20
With the recent migration to Clang 20 in openbmc-build-scripts, the
current PLDM codebase fails to compile due to stricter type checking
and unused field warnings introduced by the updated compiler.
This commit addresses the following issues to restore build stability:
1. Callback compatibility: Replaced std::bind_front with lambda
expressions that explicitly capture this, resolving type mismatch
errors when assigning member function callbacks to std::function.
2. Unused field warning: Removed the unused `bus` member variable from
the `SoftPowerOff` class and updated its constructor accordingly to
eliminate `-Wunused-private-field` warnings.
These changes are required to allow successful CI builds under the
Clang 20 toolchain.
Change-Id: I8eb909c2b1263bf7b2dbf53cdfc0424d425d352b
Signed-off-by: Eric Yang <eric.yang.wiwynn@gmail.com>
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index 644883e..77412b9 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -57,7 +57,9 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_REQUEST_UPDATE, std::move(request),
- std::bind_front(&DeviceUpdater::requestUpdate, this));
+ [this](mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen) {
+ this->requestUpdate(eid, response, respMsgLen);
+ });
if (rc)
{
// Handle error scenario
@@ -186,7 +188,9 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_PASS_COMPONENT_TABLE,
std::move(request),
- std::bind_front(&DeviceUpdater::passCompTable, this));
+ [this](mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen) {
+ this->passCompTable(eid, response, respMsgLen);
+ });
if (rc)
{
// Handle error scenario
@@ -317,7 +321,9 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_UPDATE_COMPONENT, std::move(request),
- std::bind_front(&DeviceUpdater::updateComponent, this));
+ [this](mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen) {
+ this->updateComponent(eid, response, respMsgLen);
+ });
if (rc)
{
// Handle error scenario
@@ -669,7 +675,9 @@
rc = updateManager->handler.registerRequest(
eid, instanceId, PLDM_FWUP, PLDM_ACTIVATE_FIRMWARE, std::move(request),
- std::bind_front(&DeviceUpdater::activateFirmware, this));
+ [this](mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen) {
+ this->activateFirmware(eid, response, respMsgLen);
+ });
if (rc)
{
error(