Skip to content

Commit

Permalink
fmt: use make_format_args instead of make_args_checked
Browse files Browse the repository at this point in the history
make_args_checked is deprecated
see fmtlib/fmt#2760 and the linked comment
  • Loading branch information
shuffle2 authored and Zopolis4 committed Jun 6, 2022
1 parent b56aee8 commit 3e5a076
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Source/Core/Common/Logging/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ void GenericLogFmt(LogLevel level, LogType type, const char* file, int line, con
static_assert(NumFields == sizeof...(args),
"Unexpected number of replacement fields in format string; did you pass too few or "
"too many arguments?");
GenericLogFmtImpl(level, type, file, line, format,
fmt::make_args_checked<Args...>(format, args...));
GenericLogFmtImpl(level, type, file, line, format, fmt::make_format_args(args...));
}

void GenericLog(LogLevel level, LogType type, const char* file, int line, const char* fmt, ...)
Expand Down
9 changes: 2 additions & 7 deletions Source/Core/Common/MsgHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool MsgAlertFmt(bool yes_no, MsgType style, Common::Log::LogType log_type, cons
"too many arguments?");
static_assert(fmt::is_compile_string<S>::value);
return MsgAlertFmtImpl(yes_no, style, log_type, file, line, format,
fmt::make_args_checked<Args...>(format, args...));
fmt::make_format_args(args...));
}

template <std::size_t NumFields, bool has_non_positional_args, typename S, typename... Args>
Expand All @@ -57,12 +57,7 @@ bool MsgAlertFmtT(bool yes_no, MsgType style, Common::Log::LogType log_type, con
"Unexpected number of replacement fields in format string; did you pass too few or "
"too many arguments?");
static_assert(fmt::is_compile_string<S>::value);
// It's only possible for us to compile-time check the English-language string.
// make_args_checked uses static_asserts to verify that a string is formattable with the given
// arguments. But it can't do that if the string varies at runtime, so we can't check
// translations. Still, verifying that the English string is correct will help ensure that
// translations use valid strings.
auto arg_list = fmt::make_args_checked<Args...>(format, args...);
auto arg_list = fmt::make_format_args(args...);
return MsgAlertFmtImpl(yes_no, style, log_type, file, line, translated_format, arg_list);
}

Expand Down

0 comments on commit 3e5a076

Please sign in to comment.