Reporter: Add ExprRuntimeWarning()

...and update Expr.cc invalidation messages to use it. This aligns the
warning format to the one used by runtime errors.
This commit is contained in:
Arne Welzel 2022-11-29 15:03:53 +01:00
parent 0e97c29eb8
commit a07b0c333f
4 changed files with 26 additions and 28 deletions

View file

@ -174,6 +174,21 @@ void Reporter::ExprRuntimeError(const detail::Expr* expr, const char* fmt, ...)
throw InterpreterException();
}
void Reporter::ExprRuntimeWarning(const detail::Expr* expr, const char* fmt, ...)
{
ODesc d;
expr->Describe(&d);
PushLocation(expr->GetLocationInfo());
va_list ap;
va_start(ap, fmt);
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : nullptr;
DoLog("expression warning", reporter_warning, out, nullptr, nullptr, true, true,
d.Description(), fmt, ap);
va_end(ap);
PopLocation();
}
void Reporter::RuntimeError(const detail::Location* location, const char* fmt, ...)
{
++errors;