openpower-pels: clean up various compile warnings
Compile warnings observed when compiling parts of the
openpower-pels (or corresponding tests) under stricter
compiler warning flags of Meson.
Issues fixed:
- many unused parameters
- invalid case fall-through
- excess semi-colons
- incorrect 'const' on return-by-value type
- removal of variable length array in test case
- uncaught return from 'system' call in test case
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I8af69184042cf8661d1307a02ecf3afcab4724a1
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index adea6c9..a228cbb 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -351,7 +351,7 @@
}
std::string DataInterface::expandLocationCode(const std::string& locationCode,
- uint16_t node) const
+ uint16_t /*node*/) const
{
auto method =
_bus.new_method_call(service_name::vpdManager, object_path::vpdManager,
diff --git a/extensions/openpower-pels/entry_points.cpp b/extensions/openpower-pels/entry_points.cpp
index 7d931e6..4be961b 100644
--- a/extensions/openpower-pels/entry_points.cpp
+++ b/extensions/openpower-pels/entry_points.cpp
@@ -29,7 +29,7 @@
std::unique_ptr<Manager> manager;
-DISABLE_LOG_ENTRY_CAPS();
+DISABLE_LOG_ENTRY_CAPS()
void pelStartup(internal::Manager& logManager)
{
@@ -53,7 +53,7 @@
#endif
}
-REGISTER_EXTENSION_FUNCTION(pelStartup);
+REGISTER_EXTENSION_FUNCTION(pelStartup)
void pelCreate(const std::string& message, uint32_t id, uint64_t timestamp,
Entry::Level severity, const AdditionalDataArg& additionalData,
@@ -63,21 +63,21 @@
ffdc);
}
-REGISTER_EXTENSION_FUNCTION(pelCreate);
+REGISTER_EXTENSION_FUNCTION(pelCreate)
void pelDelete(uint32_t id)
{
return manager->erase(id);
}
-REGISTER_EXTENSION_FUNCTION(pelDelete);
+REGISTER_EXTENSION_FUNCTION(pelDelete)
void pelDeleteProhibited(uint32_t id, bool& prohibited)
{
prohibited = manager->isDeleteProhibited(id);
}
-REGISTER_EXTENSION_FUNCTION(pelDeleteProhibited);
+REGISTER_EXTENSION_FUNCTION(pelDeleteProhibited)
} // namespace pels
} // namespace openpower
diff --git a/extensions/openpower-pels/event_logger.hpp b/extensions/openpower-pels/event_logger.hpp
index 9c520e6..d1736cc 100644
--- a/extensions/openpower-pels/event_logger.hpp
+++ b/extensions/openpower-pels/event_logger.hpp
@@ -121,7 +121,7 @@
*
* @param[in] source - The event source object used
*/
- void create(sdeventplus::source::EventBase& source)
+ void create(sdeventplus::source::EventBase& /*source*/)
{
_eventSource.reset();
diff --git a/extensions/openpower-pels/extended_user_data.cpp b/extensions/openpower-pels/extended_user_data.cpp
index 0731b60..6370459 100644
--- a/extensions/openpower-pels/extended_user_data.cpp
+++ b/extensions/openpower-pels/extended_user_data.cpp
@@ -100,8 +100,9 @@
}
std::optional<std::string>
- ExtendedUserData::getJSON(uint8_t creatorID,
- const std::vector<std::string>& plugins) const
+ ExtendedUserData::getJSON(uint8_t /*creatorID*/,
+ const std::vector<std::string>& plugins
+ [[maybe_unused]]) const
{
// Use the creator ID value from the section.
#ifdef PELTOOL
diff --git a/extensions/openpower-pels/extended_user_data.hpp b/extensions/openpower-pels/extended_user_data.hpp
index b0c0e88..421a6f8 100644
--- a/extensions/openpower-pels/extended_user_data.hpp
+++ b/extensions/openpower-pels/extended_user_data.hpp
@@ -77,7 +77,7 @@
*
* @return uint8_t - The creator ID
*/
- const uint8_t creatorID() const
+ uint8_t creatorID() const
{
return _creatorID;
}
diff --git a/extensions/openpower-pels/fru_identity.cpp b/extensions/openpower-pels/fru_identity.cpp
index d6a2968..4b765fd 100644
--- a/extensions/openpower-pels/fru_identity.cpp
+++ b/extensions/openpower-pels/fru_identity.cpp
@@ -51,7 +51,7 @@
}
}
-}; // namespace
+} // namespace
FRUIdentity::FRUIdentity(Stream& pel)
{
diff --git a/extensions/openpower-pels/host_notifier.cpp b/extensions/openpower-pels/host_notifier.cpp
index 8760a8b..496f1c3 100644
--- a/extensions/openpower-pels/host_notifier.cpp
+++ b/extensions/openpower-pels/host_notifier.cpp
@@ -228,7 +228,7 @@
this, std::placeholders::_1));
}
-void HostNotifier::dispatch(sdeventplus::source::EventBase& source)
+void HostNotifier::dispatch(sdeventplus::source::EventBase& /*source*/)
{
_dispatcher.reset();
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index e50d627..ef7c789 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -257,7 +257,7 @@
_repo.remove(id);
}
-bool Manager::isDeleteProhibited(uint32_t obmcLogID)
+bool Manager::isDeleteProhibited(uint32_t /*obmcLogID*/)
{
return false;
}
@@ -298,7 +298,7 @@
uint64_t timestamp,
phosphor::logging::Entry::Level severity,
const std::vector<std::string>& additionalData,
- const std::vector<std::string>& associations,
+ const std::vector<std::string>& /*associations*/,
const FFDCEntries& ffdc)
{
auto entry = _registry.lookup(message, rg::LookupType::name);
@@ -392,7 +392,7 @@
std::placeholders::_1));
}
-void Manager::closeFD(int fd, sdeventplus::source::EventBase& source)
+void Manager::closeFD(int fd, sdeventplus::source::EventBase& /*source*/)
{
close(fd);
_fdCloserEventSource.reset();
@@ -475,7 +475,7 @@
std::placeholders::_1));
}
-void Manager::pruneRepo(sdeventplus::source::EventBase& source)
+void Manager::pruneRepo(sdeventplus::source::EventBase& /*source*/)
{
auto idsToDelete = _repo.prune();
@@ -516,7 +516,7 @@
std::placeholders::_3));
}
-void Manager::pelFileDeleted(sdeventplus::source::IO& io, int fd,
+void Manager::pelFileDeleted(sdeventplus::source::IO& /*io*/, int /*fd*/,
uint32_t revents)
{
if (!(revents & EPOLLIN))
diff --git a/extensions/openpower-pels/pldm_interface.cpp b/extensions/openpower-pels/pldm_interface.cpp
index 8fa7c18..c891a4a 100644
--- a/extensions/openpower-pels/pldm_interface.cpp
+++ b/extensions/openpower-pels/pldm_interface.cpp
@@ -147,7 +147,7 @@
}
}
-int iidCallback(sd_bus_message* msg, void* data, sd_bus_error* err)
+int iidCallback(sd_bus_message* msg, void* data, sd_bus_error* /*err*/)
{
auto* interface = static_cast<PLDMInterface*>(data);
interface->instanceIDCallback(msg);
@@ -254,7 +254,7 @@
}
}
-void PLDMInterface::receive(IO& io, int fd, uint32_t revents)
+void PLDMInterface::receive(IO& /*io*/, int fd, uint32_t revents)
{
if (!(revents & EPOLLIN))
{
diff --git a/extensions/openpower-pels/repository.cpp b/extensions/openpower-pels/repository.cpp
index e044e1d..1ab774a 100644
--- a/extensions/openpower-pels/repository.cpp
+++ b/extensions/openpower-pels/repository.cpp
@@ -593,7 +593,7 @@
};
// When counting PELs, count every PEL
- IsPELTypeFunc isAnyPEL = [](const PELAttributes& pel) { return true; };
+ IsPELTypeFunc isAnyPEL = [](const PELAttributes& /*pel*/) { return true; };
// Check all 4 categories, which will result in at most 90%
// usage (15 + 30 + 15 + 30).
@@ -649,7 +649,7 @@
return pel.hostState == TransmissionState::sent;
},
- [](const auto& pel) { return true; }};
+ [](const auto& /*pel*/) { return true; }};
for (const auto& stateCheck : stateChecks)
{
diff --git a/extensions/openpower-pels/section.hpp b/extensions/openpower-pels/section.hpp
index 15ddcff..64bcda3 100644
--- a/extensions/openpower-pels/section.hpp
+++ b/extensions/openpower-pels/section.hpp
@@ -68,9 +68,9 @@
* representation, this would return the string for it.
*/
virtual std::optional<std::string>
- getJSON(message::Registry& registry,
- const std::vector<std::string>& plugins,
- uint8_t creatorID) const
+ getJSON(message::Registry& /*registry*/,
+ const std::vector<std::string>& /*plugins*/,
+ uint8_t /*creatorID*/) const
{
return std::nullopt;
}
@@ -83,8 +83,8 @@
* representation, this would return the string for it.
*/
virtual std::optional<std::string>
- getJSON(uint8_t creatorID,
- const std::vector<std::string>& plugins) const
+ getJSON(uint8_t /*creatorID*/,
+ const std::vector<std::string>& /*plugins*/) const
{
return std::nullopt;
}
@@ -103,7 +103,7 @@
*
* @return bool - true if successful, false else
*/
- virtual bool shrink(size_t newSize)
+ virtual bool shrink(size_t /*newSize*/)
{
return false;
}
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 0bbc61f..9bc3327 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -636,7 +636,8 @@
}
std::optional<std::string> SRC::getJSON(message::Registry& registry,
- const std::vector<std::string>& plugins,
+ const std::vector<std::string>& plugins
+ [[maybe_unused]],
uint8_t creatorID) const
{
std::string ps;
diff --git a/extensions/openpower-pels/user_data.cpp b/extensions/openpower-pels/user_data.cpp
index fa4c577..e8a72ef 100644
--- a/extensions/openpower-pels/user_data.cpp
+++ b/extensions/openpower-pels/user_data.cpp
@@ -96,8 +96,9 @@
}
std::optional<std::string>
- UserData::getJSON(uint8_t creatorID,
- const std::vector<std::string>& plugins) const
+ UserData::getJSON(uint8_t creatorID [[maybe_unused]],
+ const std::vector<std::string>& plugins
+ [[maybe_unused]]) const
{
#ifdef PELTOOL
return user_data::getJSON(_header.componentID, _header.subType,