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,
diff --git a/test/openpower-pels/host_notifier_test.cpp b/test/openpower-pels/host_notifier_test.cpp
index d3018dc..9a49a82 100644
--- a/test/openpower-pels/host_notifier_test.cpp
+++ b/test/openpower-pels/host_notifier_test.cpp
@@ -52,7 +52,7 @@
 
         mockHostIface = reinterpret_cast<MockHostInterface*>(hostIface.get());
 
-        auto send = [this](uint32_t id, uint32_t size) {
+        auto send = [this](uint32_t /*id*/, uint32_t /*size*/) {
             return this->mockHostIface->send(0);
         };
 
@@ -368,10 +368,10 @@
 
     HostNotifier notifier{repo, dataIface, std::move(hostIface)};
 
-    auto sendFailure = [this](uint32_t id, uint32_t size) {
+    auto sendFailure = [this](uint32_t /*id*/, uint32_t /*size*/) {
         return this->mockHostIface->send(1);
     };
-    auto sendSuccess = [this](uint32_t id, uint32_t size) {
+    auto sendSuccess = [this](uint32_t /*id*/, uint32_t /*size*/) {
         return this->mockHostIface->send(0);
     };
 
@@ -418,7 +418,7 @@
     HostNotifier notifier{repo, dataIface, std::move(hostIface)};
 
     // Every call will fail
-    auto sendFailure = [this](uint32_t id, uint32_t size) {
+    auto sendFailure = [this](uint32_t /*id*/, uint32_t /*size*/) {
         return this->mockHostIface->send(1);
     };
 
diff --git a/test/openpower-pels/mocks.hpp b/test/openpower-pels/mocks.hpp
index a2c3b5a..a6a2665 100644
--- a/test/openpower-pels/mocks.hpp
+++ b/test/openpower-pels/mocks.hpp
@@ -202,7 +202,7 @@
      * @param[in] fd - The file descriptor used
      * @param[in] events - The event bits
      */
-    void receive(sdeventplus::source::IO& source, int fd,
+    void receive(sdeventplus::source::IO& /*source*/, int /*fd*/,
                  uint32_t events) override
     {
         if (!(events & EPOLLIN))
diff --git a/test/openpower-pels/pel_manager_test.cpp b/test/openpower-pels/pel_manager_test.cpp
index a2cb5fd..4ddf81b 100644
--- a/test/openpower-pels/pel_manager_test.cpp
+++ b/test/openpower-pels/pel_manager_test.cpp
@@ -813,7 +813,11 @@
     // Delete them all at once
     auto logPath = getPELRepoPath() / "logs";
     std::string cmd = "rm " + logPath.string() + "/*";
-    system(cmd.c_str());
+
+    {
+        auto rc = system(cmd.c_str());
+        EXPECT_EQ(rc, 0);
+    }
 
     EXPECT_EQ(countPELsInRepo(), 0);
 
diff --git a/test/openpower-pels/pel_utils.cpp b/test/openpower-pels/pel_utils.cpp
index b596d34..b9b46a6 100644
--- a/test/openpower-pels/pel_utils.cpp
+++ b/test/openpower-pels/pel_utils.cpp
@@ -230,9 +230,11 @@
         case TestPELType::failingMTMSSection:
             data.insert(data.end(), failingMTMSSection.begin(),
                         failingMTMSSection.end());
+            break;
         case TestPELType::extendedUserDataSection:
             data.insert(data.end(), extendedUserDataSection.begin(),
                         extendedUserDataSection.end());
+            break;
     }
     return data;
 }
diff --git a/test/openpower-pels/stream_test.cpp b/test/openpower-pels/stream_test.cpp
index 361cfc5..d0582d7 100644
--- a/test/openpower-pels/stream_test.cpp
+++ b/test/openpower-pels/stream_test.cpp
@@ -129,9 +129,11 @@
     std::vector<uint8_t> data{0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
                               0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc};
     Stream stream{data};
-    uint8_t buf[data.size()];
 
-    stream.read(buf, data.size());
+    auto buf = decltype(data)(data.size());
+    ASSERT_EQ(data.size(), buf.size());
+
+    stream.read(buf.data(), buf.size());
 
     for (size_t i = 0; i < data.size(); i++)
     {
@@ -142,7 +144,7 @@
     }
 
     stream.offset(6);
-    stream.write(buf, 6);
+    stream.write(buf.data(), 6);
     for (size_t i = 0; i < 6; i++)
     {
         EXPECT_EQ(buf[i], data[i + 6]);