mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2024-11-26 19:20:25 +00:00
Improve debug codegen
This commit is contained in:
parent
f288f45e46
commit
8ed4a9dcc1
7
.github/workflows/windows.yml
vendored
7
.github/workflows/windows.yml
vendored
@ -15,21 +15,16 @@ jobs:
|
||||
# https://github.com/actions/virtual-environments.
|
||||
os: [windows-2019]
|
||||
platform: [Win32, x64]
|
||||
toolset: [v140, v141, v142]
|
||||
toolset: [v141, v142]
|
||||
standard: [14, 17, 20]
|
||||
shared: ["", -DBUILD_SHARED_LIBS=ON]
|
||||
build_type: [Debug, Release]
|
||||
exclude:
|
||||
- { toolset: v140, standard: 17 }
|
||||
- { toolset: v140, standard: 20 }
|
||||
- { toolset: v141, standard: 14 }
|
||||
- { toolset: v141, standard: 20 }
|
||||
- { toolset: v142, standard: 14 }
|
||||
- { platform: Win32, toolset: v140 }
|
||||
- { platform: Win32, toolset: v141 }
|
||||
- { platform: Win32, standard: 14 }
|
||||
- { platform: Win32, standard: 20 }
|
||||
- { platform: x64, toolset: v140, shared: -DBUILD_SHARED_LIBS=ON }
|
||||
- { platform: x64, toolset: v141, shared: -DBUILD_SHARED_LIBS=ON }
|
||||
- { platform: x64, standard: 14, shared: -DBUILD_SHARED_LIBS=ON }
|
||||
- { platform: x64, standard: 20, shared: -DBUILD_SHARED_LIBS=ON }
|
||||
|
@ -2238,8 +2238,19 @@ template <typename Context> class value {
|
||||
}
|
||||
FMT_ALWAYS_INLINE value(const void* val) : pointer(val) {}
|
||||
|
||||
template <typename T>
|
||||
FMT_CONSTEXPR20 FMT_ALWAYS_INLINE value(T&& val, custom_tag = {}) {
|
||||
template <typename T,
|
||||
FMT_ENABLE_IF(
|
||||
!std::is_same<T, decltype(detail::arg_mapper<char_type>::map(
|
||||
std::declval<T&>()))>::value)>
|
||||
FMT_CONSTEXPR20 FMT_ALWAYS_INLINE value(T&& val) {
|
||||
*this = arg_mapper<typename Context::char_type>::map(val);
|
||||
}
|
||||
|
||||
template <
|
||||
typename T,
|
||||
FMT_ENABLE_IF(std::is_same<T, decltype(detail::arg_mapper<char_type>::map(
|
||||
std::declval<T&>()))>::value)>
|
||||
FMT_CONSTEXPR20 FMT_ALWAYS_INLINE value(T&& val) {
|
||||
// Use enum instead of constexpr because the latter may generate code.
|
||||
enum { formattable_char = !std::is_same<T, unformattable_char>::value };
|
||||
static_assert(formattable_char, "mixing character types is disallowed");
|
||||
@ -2374,8 +2385,7 @@ struct named_arg_store {
|
||||
|
||||
template <typename... T>
|
||||
FMT_CONSTEXPR FMT_ALWAYS_INLINE named_arg_store(T&... values)
|
||||
: args{{named_args, NUM_NAMED_ARGS},
|
||||
arg_mapper<typename Context::char_type>::map(values)...} {
|
||||
: args{{named_args, NUM_NAMED_ARGS}, values...} {
|
||||
int arg_index = 0, named_arg_index = 0;
|
||||
FMT_APPLY_VARIADIC(
|
||||
init_named_arg(named_args, arg_index, named_arg_index, values));
|
||||
@ -2636,6 +2646,10 @@ template <typename Context> class basic_format_args {
|
||||
return static_cast<detail::type>((desc_ >> shift) & mask);
|
||||
}
|
||||
|
||||
template <size_t NUM_ARGS, size_t NUM_NAMED_ARGS, unsigned long long DESC>
|
||||
using store =
|
||||
detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>;
|
||||
|
||||
public:
|
||||
using format_arg = basic_format_arg<Context>;
|
||||
|
||||
@ -2646,33 +2660,26 @@ template <typename Context> class basic_format_args {
|
||||
FMT_ENABLE_IF(NUM_ARGS <= detail::max_packed_args &&
|
||||
NUM_NAMED_ARGS == 0)>
|
||||
constexpr FMT_ALWAYS_INLINE basic_format_args(
|
||||
const detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>&
|
||||
store)
|
||||
: desc_(DESC), values_(store.args) {}
|
||||
const store<NUM_ARGS, NUM_NAMED_ARGS, DESC>& s)
|
||||
: desc_(DESC), values_(s.args) {}
|
||||
|
||||
template <size_t NUM_ARGS, size_t NUM_NAMED_ARGS, unsigned long long DESC,
|
||||
FMT_ENABLE_IF(NUM_ARGS <= detail::max_packed_args &&
|
||||
NUM_NAMED_ARGS != 0)>
|
||||
constexpr FMT_ALWAYS_INLINE basic_format_args(
|
||||
const detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>&
|
||||
store)
|
||||
: desc_(DESC), values_(store.args.args + 1) {}
|
||||
constexpr basic_format_args(const store<NUM_ARGS, NUM_NAMED_ARGS, DESC>& s)
|
||||
: desc_(DESC | detail::has_named_args_bit), values_(s.args.args + 1) {}
|
||||
|
||||
template <size_t NUM_ARGS, size_t NUM_NAMED_ARGS, unsigned long long DESC,
|
||||
FMT_ENABLE_IF(NUM_ARGS > detail::max_packed_args &&
|
||||
NUM_NAMED_ARGS == 0)>
|
||||
constexpr basic_format_args(
|
||||
const detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>&
|
||||
store)
|
||||
: desc_(DESC), args_(store.args + (NUM_NAMED_ARGS != 0 ? 1 : 0)) {}
|
||||
constexpr basic_format_args(const store<NUM_ARGS, NUM_NAMED_ARGS, DESC>& s)
|
||||
: desc_(DESC), args_(s.args) {}
|
||||
|
||||
template <size_t NUM_ARGS, size_t NUM_NAMED_ARGS, unsigned long long DESC,
|
||||
FMT_ENABLE_IF(NUM_ARGS > detail::max_packed_args &&
|
||||
NUM_NAMED_ARGS != 0)>
|
||||
constexpr basic_format_args(
|
||||
const detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC>&
|
||||
store)
|
||||
: desc_(DESC), args_(store.args.args + 1) {}
|
||||
constexpr basic_format_args(const store<NUM_ARGS, NUM_NAMED_ARGS, DESC>& s)
|
||||
: desc_(DESC | detail::has_named_args_bit), args_(s.args.args + 1) {}
|
||||
|
||||
/// Constructs a `basic_format_args` object from a dynamic list of arguments.
|
||||
constexpr basic_format_args(const format_arg* args, int count,
|
||||
@ -2870,6 +2877,8 @@ struct formatter<T, Char,
|
||||
# define FMT_CUSTOM , detail::custom_tag()
|
||||
#endif
|
||||
|
||||
template <typename T> constexpr T& identity(T& x) { return x; }
|
||||
|
||||
/**
|
||||
* Constructs an object that stores references to arguments and can be
|
||||
* implicitly converted to `format_args`. `Context` can be omitted in which case
|
||||
@ -2901,6 +2910,12 @@ constexpr auto make_format_args(T&... args)
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename... T>
|
||||
using vargs =
|
||||
detail::format_arg_store<context, sizeof...(T),
|
||||
detail::count_named_args<T...>(),
|
||||
detail::make_descriptor<context, T...>()>;
|
||||
|
||||
/**
|
||||
* Returns a named argument to be used in a formatting function.
|
||||
* It should only be used in a call to a formatting function.
|
||||
|
Loading…
Reference in New Issue
Block a user