Merge pull request #10652 from shuffle2/fmt

update fmt and fix warnings that popped up with vs 17.2
This commit is contained in:
Tilka
2022-05-13 22:09:01 +01:00
committed by GitHub
24 changed files with 2257 additions and 2130 deletions

View File

@ -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, ...)

View File

@ -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>
@ -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);
}

View File

@ -30,8 +30,6 @@
<AdditionalIncludeDirectories>$(ProjectDir)Settings;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)TAS;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)VideoInterface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<!--Ignore warnings in locally-instantiated fmt templates-->
<ExternalTemplatesDiagnostics>false</ExternalTemplatesDiagnostics>
</ClCompile>
<Manifest>
<AdditionalManifestFiles>DolphinQt.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>

View File

@ -1231,10 +1231,10 @@ struct fmt::formatter<ScissorPos>
template <typename FormatContext>
auto format(const ScissorPos& pos, FormatContext& ctx)
{
return format_to(ctx.out(),
"X: {} (raw: {})\n"
"Y: {} (raw: {})",
pos.x - 342, pos.x_full, pos.y - 342, pos.y_full);
return fmt::format_to(ctx.out(),
"X: {} (raw: {})\n"
"Y: {} (raw: {})",
pos.x - 342, pos.x_full, pos.y - 342, pos.y_full);
}
};
@ -1257,10 +1257,10 @@ struct fmt::formatter<ScissorOffset>
template <typename FormatContext>
auto format(const ScissorOffset& off, FormatContext& ctx)
{
return format_to(ctx.out(),
"X: {} (raw: {})\n"
"Y: {} (raw: {})",
(off.x << 1) - 342, off.x_full, (off.y << 1) - 342, off.y_full);
return fmt::format_to(ctx.out(),
"X: {} (raw: {})\n"
"Y: {} (raw: {})",
(off.x << 1) - 342, off.x_full, (off.y << 1) - 342, off.y_full);
}
};