error: Fix "to current monitor if we have one" comments

A number of print functions are documented to print to "current
monitor if we have one, else stderr".  Wrong, they print to the
current monitor only when it's HMP.  This is the case since commit
4ad417baa4 (error: Print error_report() to stderr if using qmp).

Fix the comments to say "current HMP monitor if we have one".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260114124713.3308719-2-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[Commit a582a5784e (monitor: move error_vprintf back to
error-report.c) lost a comment this commit fixes, restore it]
This commit is contained in:
Markus Armbruster
2026-01-14 13:47:11 +01:00
parent 824141dcf4
commit 5237737439
3 changed files with 23 additions and 13 deletions

View File

@@ -64,7 +64,8 @@
*
* = Reporting and destroying errors =
*
* Report an error to the current monitor if we have one, else stderr:
* Report an error to the current HMP monitor if we have one, else
* stderr:
* error_report_err(err);
* This frees the error object.
*

View File

@@ -62,6 +62,9 @@ error_printf_mon(Monitor *cur_mon, const char *fmt, ...)
return ret;
}
/*
* Print to the current HMP monitor if we have one, else to stderr.
*/
int error_vprintf(const char *fmt, va_list ap)
{
return error_vprintf_mon(monitor_cur(), fmt, ap);
@@ -174,7 +177,8 @@ void loc_set_file(const char *fname, int lno)
}
/*
* Print current location to current monitor if we have one, else to stderr.
* Print current location to current HMP monitor if we have one, else
* to stderr.
*/
static void print_loc(Monitor *cur)
{
@@ -214,7 +218,8 @@ char *real_time_iso8601(void)
}
/*
* Print a message to current monitor if we have one, else to stderr.
* Print a message to current HMP monitor if we have one, else to
* stderr.
* @report_type is the type of message: error, warning or informational.
* Format arguments like vsprintf(). The resulting message should be
* a single phrase, with no newline or trailing punctuation.
@@ -270,7 +275,8 @@ static void vreport(report_type type, const char *fmt, va_list ap)
}
/*
* Print an error message to current monitor if we have one, else to stderr.
* Print an error message to current HMP monitor if we have one, else
* to stderr.
* Format arguments like vsprintf(). The resulting message should be
* a single phrase, with no newline or trailing punctuation.
* Prepend the current location and append a newline.
@@ -282,7 +288,8 @@ void error_vreport(const char *fmt, va_list ap)
}
/*
* Print a warning message to current monitor if we have one, else to stderr.
* Print a warning message to current HMP monitor if we have one, else
* to stderr.
* Format arguments like vsprintf(). The resulting message should be
* a single phrase, with no newline or trailing punctuation.
* Prepend the current location and append a newline.
@@ -293,8 +300,8 @@ void warn_vreport(const char *fmt, va_list ap)
}
/*
* Print an information message to current monitor if we have one, else to
* stderr.
* Print an information message to current HMP monitor if we have one,
* else to stderr.
* Format arguments like vsprintf(). The resulting message should be
* a single phrase, with no newline or trailing punctuation.
* Prepend the current location and append a newline.
@@ -305,7 +312,8 @@ void info_vreport(const char *fmt, va_list ap)
}
/*
* Print an error message to current monitor if we have one, else to stderr.
* Print an error message to current HMP monitor if we have one, else
* to stderr.
* Format arguments like sprintf(). The resulting message should be
* a single phrase, with no newline or trailing punctuation.
* Prepend the current location and append a newline.
@@ -321,7 +329,8 @@ void error_report(const char *fmt, ...)
}
/*
* Print a warning message to current monitor if we have one, else to stderr.
* Print a warning message to current HMP monitor if we have one, else
* to stderr.
* Format arguments like sprintf(). The resulting message should be a
* single phrase, with no newline or trailing punctuation.
* Prepend the current location and append a newline.
@@ -336,8 +345,8 @@ void warn_report(const char *fmt, ...)
}
/*
* Print an information message to current monitor if we have one, else to
* stderr.
* Print an information message to current HMP monitor if we have one,
* else to stderr.
* Format arguments like sprintf(). The resulting message should be a
* single phrase, with no newline or trailing punctuation.
* Prepend the current location and append a newline.

View File

@@ -16,7 +16,7 @@
/*
* Print like vprintf().
* Print to current monitor if we have one, else to stdout.
* Print to current HMP monitor if we have one, else to stdout.
*/
int qemu_vprintf(const char *fmt, va_list ap)
{
@@ -29,7 +29,7 @@ int qemu_vprintf(const char *fmt, va_list ap)
/*
* Print like printf().
* Print to current monitor if we have one, else to stdout.
* Print to current HMP monitor if we have one, else to stdout.
*/
int qemu_printf(const char *fmt, ...)
{