On Fri, Sep 18, 2026 at 07:29:58PM -0300, Fabiano Rosas wrote: > Passing a boolean into get_opt_name_value() is to put too much > responsibility into this low-level routine. Have it just fill an Error > object and let the caller decide what to do with it. Setting an Error > is an easily recognizable pattern so it saves the reader from mentally > parsing the boolean logic. > > Signed-off-by: Fabiano Rosas <[email protected]> > --- > util/qemu-option.c | 27 +++++++++++++++++---------- > 1 file changed, 17 insertions(+), 10 deletions(-) > > diff --git a/util/qemu-option.c b/util/qemu-option.c > index 37e6d68f02..94e06b194d 100644 > --- a/util/qemu-option.c > +++ b/util/qemu-option.c > @@ -756,9 +756,9 @@ void qemu_opts_print(QemuOpts *opts, const char > *separator) > > static const char *get_opt_name_value(const char *params, > const char *firstname, > - bool warn_on_flag, > bool *help_wanted, > - char **name, char **value) > + char **name, char **value, > + Error **errp) > { > const char *p; > const char *prefix = ""; > @@ -783,13 +783,15 @@ static const char *get_opt_name_value(const char > *params, > *value = g_strdup("on"); > is_help = is_help_option(*name); > } > - if (!is_help && warn_on_flag) { > - warn_report("short-form boolean option '%s%s' deprecated", > prefix, *name); > + if (!is_help) { > if (g_str_equal(*name, "delay")) { > - error_printf("Please use nodelay=%s instead\n", > prefix[0] ? "on" : "off"); > + error_setg(errp, "Please use nodelay=%s instead", > + prefix[0] ? "on" : "off"); > } else { > - error_printf("Please use %s=%s instead\n", *name, > *value); > + error_setg(errp, "Please use %s=%s instead", *name, > *value); > } > + error_prepend(errp, "short-form boolean option '%s%s' " > + "deprecated", prefix, *name); > } > }
We've had short form bool options deprecated for years now. I'd be inclined to follow through on the deprecation and delete support for short form bools now. With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
