Fix some format string specifier type errors in recent compilers

This commit is contained in:
Danny Robson 2021-11-07 06:12:34 +10:00
parent 4d1ee7c21e
commit 3cf386390f
4 changed files with 20 additions and 4 deletions

View File

@ -82,7 +82,7 @@ prepare_debugger (void)
void
await_debugger (void)
{
LOG_INFO ("awaiting debugger");
LOG_INFO ("%s", "awaiting debugger");
if (is_debugged ())
breakpoint ();

View File

@ -20,6 +20,22 @@ namespace cruft::log {
{ ; }
template <typename ...ArgsT>
packet (
level_t _level,
std::string_view _format,
ArgsT &&..._args
) : packet (
_level,
fmt::vformat (
_format,
fmt::make_format_args(
std::forward<ArgsT> (_args)...
)
)
)
{ ; }
template <typename FormatT, typename ...ArgsT>
packet (
level_t _level,

View File

@ -50,7 +50,7 @@ cruft::log::scoped_timer::~scoped_timer ()
write (
m_level,
"{:f}s, {:s}",
FMT_STRING("{:f}s, {:s}"),
float (duration) / 1'000'000'000.f,
m_message
);

View File

@ -34,8 +34,8 @@ int main (int const argc, char const **argv)
auto const count = argc - 3;
switch (count) {
case 0: cruft::log::write (level, format); break;
case 1: cruft::log::write (level, format, argv[MIN_ARGS + 0]); break;
case 2: cruft::log::write (level, format, argv[MIN_ARGS + 0], argv[MIN_ARGS + 1]); break;
case 1: cruft::log::write (level, std::string_view{format}, argv[MIN_ARGS + 0]); break;
case 2: cruft::log::write (level, std::string_view{format}, argv[MIN_ARGS + 0], argv[MIN_ARGS + 1]); break;
}
return EXIT_SUCCESS;