meson: Fix compile errors
Meson runs stricter compiler checks. Fix the following errors in
preparation to moving to meson:
- Unusued parameters. Ex:
../download_manager_main.cpp:7:14: error: unused parameter ‘argc’ [-Werror=unused-parameter]
../static/item_updater_helper.cpp:16:42: error: unused parameter ‘entryId’ [-Werror=unused-parameter]
../watch.cpp:77:38: error: unused parameter ‘s’ [-Werror=unused-parameter]
[test/utest.cpp:166]: (style) Variable 'pubKeyConfFile' is assigned a value that is never used.
- Add destructor and initialize variable in init list:
../flash.hpp:18:7: error: ‘class phosphor::software::updater::Flash’ has virtual functions and accessible non-virtual destructor [-Werror=non-virtual-dtor]
[version.hpp:81]: callback is assigned in constructor body. Consider performing initialization in initialization list
Tested: Verified code update on witherspoon still worked.
Change-Id: Ib7a0e0e11d6bfe6eeeb3f2ea4bfefd43505d639e
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/download_manager_main.cpp b/download_manager_main.cpp
index cf4cb82..c61e185 100644
--- a/download_manager_main.cpp
+++ b/download_manager_main.cpp
@@ -4,7 +4,7 @@
#include <sdbusplus/bus.hpp>
-int main(int argc, char* argv[])
+int main()
{
auto bus = sdbusplus::bus::new_default();
diff --git a/flash.hpp b/flash.hpp
index 5069680..c276017 100644
--- a/flash.hpp
+++ b/flash.hpp
@@ -18,6 +18,9 @@
class Flash
{
public:
+ /* Destructor */
+ virtual ~Flash() = default;
+
/**
* @brief Writes the image file(s) to flash
*/
diff --git a/image_manager_main.cpp b/image_manager_main.cpp
index af711a7..867a960 100644
--- a/image_manager_main.cpp
+++ b/image_manager_main.cpp
@@ -8,7 +8,7 @@
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
-int main(int argc, char* argv[])
+int main()
{
using namespace phosphor::software::manager;
auto bus = sdbusplus::bus::new_default();
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
index 3568124..79c4fd8 100644
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -5,7 +5,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
-int main(int argc, char* argv[])
+int main()
{
auto bus = sdbusplus::bus::new_default();
diff --git a/static/item_updater_helper.cpp b/static/item_updater_helper.cpp
index 164784d..213da05 100644
--- a/static/item_updater_helper.cpp
+++ b/static/item_updater_helper.cpp
@@ -13,12 +13,12 @@
#define SERVICE_FACTORY_RESET \
"obmc-flash-bmc-setenv@" ENV_FACTORY_RESET ".service"
-void Helper::setEntry(const std::string& entryId, uint8_t value)
+void Helper::setEntry(const std::string& /* entryId */, uint8_t /* value */)
{
// Empty
}
-void Helper::clearEntry(const std::string& entryId)
+void Helper::clearEntry(const std::string& /* entryId */)
{
// Empty
}
@@ -38,12 +38,12 @@
bus.call_noreply(method);
}
-void Helper::removeVersion(const std::string& versionId)
+void Helper::removeVersion(const std::string& /* versionId */)
{
// Empty
}
-void Helper::updateUbootVersionId(const std::string& versionId)
+void Helper::updateUbootVersionId(const std::string& /* versionId */)
{
// Empty
}
diff --git a/sync_manager_main.cpp b/sync_manager_main.cpp
index 1be7f7d..a808702 100644
--- a/sync_manager_main.cpp
+++ b/sync_manager_main.cpp
@@ -10,7 +10,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
-int main(int argc, char* argv[])
+int main()
{
auto bus = sdbusplus::bus::new_default();
diff --git a/sync_watch.cpp b/sync_watch.cpp
index bb2a860..c0f0f21 100644
--- a/sync_watch.cpp
+++ b/sync_watch.cpp
@@ -73,7 +73,7 @@
}
}
-int SyncWatch::callback(sd_event_source* s, int fd, uint32_t revents,
+int SyncWatch::callback(sd_event_source* /* s */, int fd, uint32_t revents,
void* userdata)
{
if (!(revents & EPOLLIN))
diff --git a/test/utest.cpp b/test/utest.cpp
index 0d8e306..20b2c2a 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -194,8 +194,6 @@
command("openssl rsa -in " + pkeyFile + " -outform PEM " +
"-pubout -out " + pubkeyFile);
- std::string pubKeyConfFile =
- signedConfOpenBMCPath.string() + "/" + "publickey";
command("cp " + pubkeyFile + " " + signedConfOpenBMCPath.string());
command(opensslCmd + pkeyFile + " -out " + kernelFile + ".sig " +
kernelFile);
diff --git a/version.hpp b/version.hpp
index e26e4eb..5827c8a 100644
--- a/version.hpp
+++ b/version.hpp
@@ -76,10 +76,8 @@
const std::string& versionString, VersionPurpose versionPurpose,
const std::string& filePath, eraseFunc callback) :
VersionInherit(bus, (objPath).c_str(), true),
- versionStr(versionString)
+ eraseCallback(callback), versionStr(versionString)
{
- // Bind erase method
- eraseCallback = callback;
// Set properties.
purpose(versionPurpose);
version(versionString);
diff --git a/watch.cpp b/watch.cpp
index e46b8aa..090e560 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -74,7 +74,7 @@
}
}
-int Watch::callback(sd_event_source* s, int fd, uint32_t revents,
+int Watch::callback(sd_event_source* /* s */, int fd, uint32_t revents,
void* userdata)
{
if (!(revents & EPOLLIN))