Improve narrow() and size32() with src_loc detection

This commit is contained in:
Nekotekina 2020-12-09 16:03:15 +03:00
parent e055d16b2c
commit 5d934c8759
16 changed files with 69 additions and 48 deletions

View file

@ -287,7 +287,7 @@ namespace fmt
thread_ctrl::emergency_exit(out);
}
void raw_narrow_error(const char* msg, const fmt_type_info* sup, u64 arg)
void raw_narrow_error(const src_loc& loc, const fmt_type_info* sup, u64 arg)
{
std::string out{"Narrow error"};
@ -298,10 +298,22 @@ namespace fmt
out += ")";
}
if (msg)
if (loc.col != umax)
{
out += ": ";
out += msg;
fmt::append(out, "\n(in file %s:%s[:%s]", loc.file, loc.line, loc.col);
}
else
{
fmt::append(out, "\n(in file %s:%s", loc.file, loc.line);
}
if (loc.func && *loc.func)
{
fmt::append(out, ", in function %s)", loc.func);
}
else
{
out += ')';
}
thread_ctrl::emergency_exit(out);