PEL: Fixes for gcc13
* Add the cstdint header file as now required to get the uint* types.
* Fix a move assignment test
* Refactor some nlohmann::json code to avoid:
```
/usr/include/c++/13/valarray:1201:1: note: template argument deduction/substitution failed:
../extensions/openpower-pels/registry.cpp:665:43: note: ‘const nlohmann::json_abi_v3_11_2::basic_json<>::value_type’ {aka ‘const nlohmann::json_abi_v3_11_2::basic_json<>’} is not derived from ‘const std::valarray<_Tp>’
665 | (name == j["SRC"]["ReasonCode"] && type == LookupType::reasonCode));
```
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ia3e733602134a60008d0d47934f95a217d2a0eb1
diff --git a/extensions/openpower-pels/dbus_types.hpp b/extensions/openpower-pels/dbus_types.hpp
index 047ef77..0b388e3 100644
--- a/extensions/openpower-pels/dbus_types.hpp
+++ b/extensions/openpower-pels/dbus_types.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <cstdint>
#include <map>
#include <string>
#include <variant>
diff --git a/extensions/openpower-pels/json_utils.hpp b/extensions/openpower-pels/json_utils.hpp
index 4ee32f4..2065952 100644
--- a/extensions/openpower-pels/json_utils.hpp
+++ b/extensions/openpower-pels/json_utils.hpp
@@ -3,6 +3,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <cstdint>
#include <fstream>
#include <iomanip>
#include <iostream>
diff --git a/extensions/openpower-pels/pel_values.hpp b/extensions/openpower-pels/pel_values.hpp
index d737267..16556f3 100644
--- a/extensions/openpower-pels/pel_values.hpp
+++ b/extensions/openpower-pels/pel_values.hpp
@@ -2,6 +2,7 @@
#include "pel_types.hpp"
+#include <cstdint>
#include <map>
#include <string>
#include <tuple>
diff --git a/extensions/openpower-pels/registry.cpp b/extensions/openpower-pels/registry.cpp
index e646928..aeba998 100644
--- a/extensions/openpower-pels/registry.cpp
+++ b/extensions/openpower-pels/registry.cpp
@@ -659,10 +659,11 @@
const auto& registry = reg.value();
// Find an entry with this name in the PEL array.
auto e = std::find_if(registry["PELs"].begin(), registry["PELs"].end(),
- [&name, &type](const auto& j) {
- return (
- (name == j["Name"] && type == LookupType::name) ||
- (name == j["SRC"]["ReasonCode"] && type == LookupType::reasonCode));
+ [&name, &type](const nlohmann::json& j) {
+ return ((name == j.at("Name").get<std::string>() &&
+ type == LookupType::name) ||
+ (name == j.at("SRC").at("ReasonCode").get<std::string>() &&
+ type == LookupType::reasonCode));
});
if (e != registry["PELs"].end())
diff --git a/extensions/openpower-pels/user_data_json.hpp b/extensions/openpower-pels/user_data_json.hpp
index 9d6b79d..930e378 100644
--- a/extensions/openpower-pels/user_data_json.hpp
+++ b/extensions/openpower-pels/user_data_json.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <cstdint>
#include <optional>
#include <string>
#include <vector>
diff --git a/test/openpower-pels/temporary_file_test.cpp b/test/openpower-pels/temporary_file_test.cpp
index 4fb22cc..425700a 100644
--- a/test/openpower-pels/temporary_file_test.cpp
+++ b/test/openpower-pels/temporary_file_test.cpp
@@ -193,7 +193,7 @@
fs::path path = tmpFile->getPath();
// Try to move object into itself; should do nothing
- tmpFile = std::move(tmpFile);
+ *tmpFile = static_cast<TemporaryFile&&>(*tmpFile);
// Verify object still owns same temporary file and file exists
EXPECT_EQ(tmpFile->getPath(), path);