mirror of https://github.com/PCSX2/pcsx2.git
Misc: Fix fmt errors
This commit is contained in:
parent
279c84f8e1
commit
cefcd843fc
|
@ -114,6 +114,9 @@ if(GCC_VERSION VERSION_GREATER_EQUAL "9.0" AND GCC_VERSION VERSION_LESS "9.2")
|
|||
This text being in a compile log in an open issue may cause it to be closed.")
|
||||
endif()
|
||||
|
||||
# Prevent fmt from being built with exceptions, or being thrown at call sites.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFMT_EXCEPTIONS=0")
|
||||
|
||||
add_subdirectory(3rdparty/fmt/fmt EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(3rdparty/rapidyaml/rapidyaml EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(3rdparty/lzma EXCLUDE_FROM_ALL)
|
||||
|
|
|
@ -321,3 +321,25 @@ __fi void SmallStringBase::fmt(fmt::format_string<T...> fmt, T&&... args)
|
|||
clear();
|
||||
fmt::vformat_to(std::back_inserter(*this), fmt, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
#define MAKE_FORMATTER(type) \
|
||||
template <> \
|
||||
struct fmt::formatter<type> \
|
||||
{ \
|
||||
template <typename ParseContext> \
|
||||
constexpr auto parse(ParseContext& ctx) \
|
||||
{ \
|
||||
return ctx.begin(); \
|
||||
} \
|
||||
\
|
||||
template <typename FormatContext> \
|
||||
auto format(const type& str, FormatContext& ctx) \
|
||||
{ \
|
||||
return fmt::format_to(ctx.out(), "{}", str.view()); \
|
||||
} \
|
||||
};
|
||||
|
||||
MAKE_FORMATTER(TinyString);
|
||||
MAKE_FORMATTER(SmallString);
|
||||
|
||||
#undef MAKE_FORMATTER
|
Loading…
Reference in New Issue