gcc13 : fix argument format issues
gcc13 based build failed with below error.
error: static assertion failed: Cannot format an argument.
To make type T formattable provide a formatter<T> specialization:
https://fmt.dev/latest/api.html#udt
Problem looks similar to https://github.com/fmtlib/fmt/issues/391
Fix is to convert the "enum" type to underlying_type in fmt::format function.
Change-Id: I155fc854428492462dfec3b3818d08daa16e36bf
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index 81ef6be..4cbf5af 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -418,7 +418,9 @@
void processIplErrorCallback(const ipl_error_info& errInfo)
{
log<level::INFO>(
- fmt::format("processIplErrorCallback: Error type({})", errInfo.type)
+ fmt::format("processIplErrorCallback: Error type({})",
+ static_cast<std::underlying_type<ipl_error_type>::type>(
+ errInfo.type))
.c_str());
switch (errInfo.type)
diff --git a/procedures/phal/thread_stopall.cpp b/procedures/phal/thread_stopall.cpp
index 8c77690..0355eb2 100644
--- a/procedures/phal/thread_stopall.cpp
+++ b/procedures/phal/thread_stopall.cpp
@@ -4,6 +4,7 @@
#include <attributes_info.H>
#include <fmt/format.h>
+#include <libipl.H>
#include <libphal.H>
#include <phal_exception.H>
extern "C"
@@ -76,8 +77,12 @@
if (errType == SBE_CMD_FAILED)
{
log<level::ERR>(
- fmt::format("threadStopAll failed({}) on proc({})",
- errType, pdbg_target_index(procTarget))
+ fmt::format(
+ "threadStopAll failed({}) on proc({})",
+ static_cast<
+ std::underlying_type<ipl_error_type>::type>(
+ errType),
+ pdbg_target_index(procTarget))
.c_str());
uint32_t index = pdbg_target_index(procTarget);