phal: fix ignoring attributes warning
This to fix the below compilation warnings with latest
yocto rebase .
einit_devtree.cpp:28:62: error: ignoring attributes
on template argument 'int (*)(FILE*)'
[-Werror=ignored-attributes]
| 28 | using FILE_Ptr =
std::unique_ptr<FILE, decltype(&std::fclose)>;
Change-Id: I12e0f4034eea80d19c0f1236102ab0bafd42432e
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/procedures/phal/reinit_devtree.cpp b/procedures/phal/reinit_devtree.cpp
index 1e9918f..f0cf22e 100644
--- a/procedures/phal/reinit_devtree.cpp
+++ b/procedures/phal/reinit_devtree.cpp
@@ -23,7 +23,16 @@
namespace phal
{
using namespace phosphor::logging;
-using FILE_Ptr = std::unique_ptr<FILE, decltype(&::fclose)>;
+
+struct FileCloser
+{
+ void operator()(FILE* fp) const
+ {
+ fclose(fp);
+ }
+};
+using FILE_Ptr = std::unique_ptr<FILE, FileCloser>;
+
namespace fs = std::filesystem;
void applyAttrOverride(fs::path& devtreeFile)
@@ -36,7 +45,7 @@
}
// Open attribute override file in r/o mode
- FILE_Ptr fpOverride(fopen(DEVTREE_ATTR_OVERRIDE_PATH, "r"), fclose);
+ FILE_Ptr fpOverride(fopen(DEVTREE_ATTR_OVERRIDE_PATH, "r"), FileCloser());
// Update Devtree with attribute override data.
auto ret = dtree_cronus_import(devtreeFile.c_str(), CEC_INFODB_PATH,
@@ -142,7 +151,8 @@
{
// get temporary datafile pointer.
- FILE_Ptr fpExport(fopen(tmpFile.getPath().c_str(), "w+"), fclose);
+ FILE_Ptr fpExport(fopen(tmpFile.getPath().c_str(), "w+"),
+ FileCloser());
if (fpExport.get() == nullptr)
{
@@ -174,7 +184,7 @@
std::filesystem::copy(roFilePath, tmpDevtreePath, copyOptions);
// get r/o version data file pointer
- FILE_Ptr fpImport(fopen(tmpFile.getPath().c_str(), "r"), fclose);
+ FILE_Ptr fpImport(fopen(tmpFile.getPath().c_str(), "r"), FileCloser());
if (fpImport.get() == nullptr)
{
log<level::ERR>(