diff --git a/include/common/enum_errcode.hpp b/include/common/enum_errcode.hpp index bda7d9e2..c075ed74 100644 --- a/include/common/enum_errcode.hpp +++ b/include/common/enum_errcode.hpp @@ -131,4 +131,8 @@ static inline constexpr const auto ErrCodeStr = []() constexpr { } (); +inline uint32_t format_as(ErrCode code) { + return code.getCode(); +} + } // namespace WasmEdge diff --git a/thirdparty/wasi/api.hpp b/thirdparty/wasi/api.hpp index 97d37c83..53fadf1d 100644 --- a/thirdparty/wasi/api.hpp +++ b/thirdparty/wasi/api.hpp @@ -21,6 +21,7 @@ #include #include #include +#include using const_uint8_t_ptr = uint32_t; using uint8_t_ptr = uint32_t; @@ -562,6 +563,10 @@ enum __wasi_errno_t : uint16_t { static_assert(sizeof(__wasi_errno_t) == 2, "witx calculated size"); static_assert(alignof(__wasi_errno_t) == 2, "witx calculated align"); +inline uint16_t format_as(__wasi_errno_t error) { + return fmt::underlying(error); +} + /** * File descriptor rights, determining which actions may be performed. */