mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
Fix type-safe formatting
This commit is contained in:
parent
1d86c60548
commit
57f394e156
@ -74,8 +74,7 @@ namespace logs
|
|||||||
if (UNLIKELY(sev <= enabled))
|
if (UNLIKELY(sev <= enabled))
|
||||||
{
|
{
|
||||||
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
|
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
|
||||||
const u64 arg_array[sizeof...(Args) + 1]{fmt_unveil<Args>::get(args)...};
|
message{this, sev}.broadcast(fmt, type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||||
message{this, sev}.broadcast(fmt, type_list, arg_array);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +244,10 @@ struct fmt_type_info
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Argument array type (each element generated via fmt_unveil<>)
|
||||||
|
template <typename... Args>
|
||||||
|
using fmt_args_t = const u64(&&)[sizeof...(Args) + 1];
|
||||||
|
|
||||||
namespace fmt
|
namespace fmt
|
||||||
{
|
{
|
||||||
// Base-57 format helper
|
// Base-57 format helper
|
||||||
@ -286,8 +290,7 @@ namespace fmt
|
|||||||
SAFE_BUFFERS FORCE_INLINE void append(std::string& out, const char* fmt, const Args&... args)
|
SAFE_BUFFERS FORCE_INLINE void append(std::string& out, const char* fmt, const Args&... args)
|
||||||
{
|
{
|
||||||
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
|
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
|
||||||
const u64 arg_array[sizeof...(Args) + 1]{fmt_unveil<Args>::get(args)...};
|
raw_append(out, fmt, type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||||
raw_append(out, fmt, type_list, arg_array);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formatting function
|
// Formatting function
|
||||||
@ -308,7 +311,6 @@ namespace fmt
|
|||||||
[[noreturn]] SAFE_BUFFERS FORCE_INLINE void throw_exception(const char* fmt, const Args&... args)
|
[[noreturn]] SAFE_BUFFERS FORCE_INLINE void throw_exception(const char* fmt, const Args&... args)
|
||||||
{
|
{
|
||||||
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
|
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
|
||||||
const u64 arg_array[sizeof...(Args) + 1]{fmt_unveil<Args>::get(args)...};
|
raw_throw_exception<T>(fmt, type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||||
raw_throw_exception<T>(fmt, type_list, arg_array);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user