fix readability-make-member-function-const A number of getter methods can be made const. This is a clang-tidy check, but readability-make-member-function-const is not added to the configuration as it does not yet exist in the reference tidy configuration. Tested: Ran unit tests Change-Id: Ib2a094b72611c7adce74042ada3796ab4c0c369e Signed-off-by: Brad Bishop <bradbish@qti.qualcomm.com>
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp index 649e6f6..153b080 100644 --- a/host-bmc/host_pdr_handler.cpp +++ b/host-bmc/host_pdr_handler.cpp
@@ -788,7 +788,7 @@ } } -bool HostPDRHandler::isHostUp() +bool HostPDRHandler::isHostUp() const { return responseReceived; }
diff --git a/host-bmc/host_pdr_handler.hpp b/host-bmc/host_pdr_handler.hpp index c1369f8..4dcdbb2 100644 --- a/host-bmc/host_pdr_handler.hpp +++ b/host-bmc/host_pdr_handler.hpp
@@ -172,7 +172,7 @@ /** @brief check whether Host is running when pldmd starts */ - bool isHostUp(); + bool isHostUp() const; /* @brief Method to set the oem platform handler in host pdr handler class *
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp index 1e74bb0..cc1035f 100644 --- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp +++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -39,7 +39,7 @@ int DumpHandler::fd = -1; namespace fs = std::filesystem; -std::string DumpHandler::findDumpObjPath(uint32_t fileHandle) +std::string DumpHandler::findDumpObjPath(uint32_t fileHandle) const { static constexpr auto DUMP_MANAGER_BUSNAME = "xyz.openbmc_project.Dump.Manager";
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.hpp b/oem/ibm/libpldmresponder/file_io_type_dump.hpp index 4379d09..5fe1916 100644 --- a/oem/ibm/libpldmresponder/file_io_type_dump.hpp +++ b/oem/ibm/libpldmresponder/file_io_type_dump.hpp
@@ -52,7 +52,7 @@ uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/); - std::string findDumpObjPath(uint32_t fileHandle); + std::string findDumpObjPath(uint32_t fileHandle) const; std::string getOffloadUri(uint32_t fileHandle); /** @brief DumpHandler destructor
diff --git a/oem/ibm/libpldmresponder/inband_code_update.hpp b/oem/ibm/libpldmresponder/inband_code_update.hpp index 1080bc8..ee5db5e 100644 --- a/oem/ibm/libpldmresponder/inband_code_update.hpp +++ b/oem/ibm/libpldmresponder/inband_code_update.hpp
@@ -99,7 +99,7 @@ * going on * @return - bool */ - bool isCodeUpdateInProgress() + bool isCodeUpdateInProgress() const { return codeUpdateInProgress; } @@ -138,7 +138,7 @@ * validation PDR * @return - sensor id */ - uint16_t getMarkerLidSensor() + uint16_t getMarkerLidSensor() const { return markerLidSensorId; } @@ -163,7 +163,7 @@ /* @brief Method to fetch the sensor id for firmware update state * @return - sensor id */ - uint16_t getFirmwareUpdateSensor() + uint16_t getFirmwareUpdateSensor() const { return firmwareUpdateSensorId; } @@ -180,7 +180,7 @@ /* @brief Method to fetch the sensor id for boot side rename state * @return - sensor id */ - uint16_t getBootSideRenameStateSensor() + uint16_t getBootSideRenameStateSensor() const { return bootSideRenameStateSensorId; }
diff --git a/platform-mc/numeric_sensor.cpp b/platform-mc/numeric_sensor.cpp index 31d1cf5..ada8ca4 100644 --- a/platform-mc/numeric_sensor.cpp +++ b/platform-mc/numeric_sensor.cpp
@@ -682,7 +682,7 @@ } } -double NumericSensor::conversionFormula(double value) +double NumericSensor::conversionFormula(double value) const { double convertedValue = value; if (std::isfinite(resolution)) @@ -696,7 +696,7 @@ return convertedValue; } -double NumericSensor::unitModifier(double value) +double NumericSensor::unitModifier(double value) const { if (!std::isfinite(value)) { @@ -1052,7 +1052,7 @@ } } -void NumericSensor::createNormalRangeLog(double value) +void NumericSensor::createNormalRangeLog(double value) const { namespace Events = sdbusplus::event::xyz::openbmc_project::sensor::Threshold;
diff --git a/platform-mc/numeric_sensor.hpp b/platform-mc/numeric_sensor.hpp index e0103bd..9f4fcb0 100644 --- a/platform-mc/numeric_sensor.hpp +++ b/platform-mc/numeric_sensor.hpp
@@ -79,14 +79,14 @@ * @param[in] value - raw value * @return double - converted value */ - double conversionFormula(double value); + double conversionFormula(double value) const; /** @brief UnitModifier is used to apply the unit modifier specified in PDR * * @param[in] value - raw value * @return double - converted value */ - double unitModifier(double value); + double unitModifier(double value) const; /** @brief Check if value is over threshold. * @@ -403,7 +403,7 @@ * * @param[in] value - The current sensor value in normal range. */ - void createNormalRangeLog(double value); + void createNormalRangeLog(double value) const; /** * @brief Create a threshold log for the given level/direction tuple.
diff --git a/platform-mc/terminus.hpp b/platform-mc/terminus.hpp index ac26086..4627737 100644 --- a/platform-mc/terminus.hpp +++ b/platform-mc/terminus.hpp
@@ -98,7 +98,7 @@ void parseTerminusPDRs(); /** @brief The getter to return terminus's TID */ - pldm_tid_t getTid() + pldm_tid_t getTid() const { return tid; }
diff --git a/platform-mc/terminus_manager.hpp b/platform-mc/terminus_manager.hpp index 7f85124..f1bfe79 100644 --- a/platform-mc/terminus_manager.hpp +++ b/platform-mc/terminus_manager.hpp
@@ -147,7 +147,7 @@ * * @return uint8_t - local EID */ - mctp_eid_t getLocalEid() + mctp_eid_t getLocalEid() const { return localEid; }
diff --git a/pldmtool/pldm_cmd_helper.hpp b/pldmtool/pldm_cmd_helper.hpp index 49c23dd..d4b65a9 100644 --- a/pldmtool/pldm_cmd_helper.hpp +++ b/pldmtool/pldm_cmd_helper.hpp
@@ -117,7 +117,7 @@ * * @return uint8_t - MCTP endpoint ID */ - inline uint8_t getMCTPEID() + inline uint8_t getMCTPEID() const { return mctp_eid; }
diff --git a/softoff/softoff.hpp b/softoff/softoff.hpp index 9ec13a1..72a9f8a 100644 --- a/softoff/softoff.hpp +++ b/softoff/softoff.hpp
@@ -33,7 +33,7 @@ * if hasError is true, that means the pldm-softpoweroff failed to * trigger the host soft off,so the pldm-softpoweroff will exit. */ - inline bool isError() + inline bool isError() const { return hasError; } @@ -47,14 +47,14 @@ /** @brief Is the host soft off completed. */ - inline bool isCompleted() + inline bool isCompleted() const { return completed; } /** @brief Is receive the response for the PLDM request msg. */ - inline bool isReceiveResponse() + inline bool isReceiveResponse() const { return responseReceived; }