From: John Snow <jsnow@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Eric Blake" <eblake@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Max Reitz" <mreitz@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/4] hw/block/fdc: Replace error_setg(&error_abort) by assert()
Date: Fri, 8 Jun 2018 11:03:43 -0400 [thread overview]
Message-ID: <45a8a086-a04b-bc54-31a1-570521c657cf@redhat.com> (raw)
In-Reply-To: <87k1r9dd8c.fsf@dusky.pond.sub.org>
On 06/08/2018 02:05 AM, Markus Armbruster wrote:
> John Snow <jsnow@redhat.com> writes:
>
>> On 06/07/2018 10:46 AM, Philippe Mathieu-Daudé wrote:
>>> Use assert() instead of error_setg(&error_abort),
>>> as suggested by the "qapi/error.h" documentation:
>>>
>>> Please don't error_setg(&error_fatal, ...), use error_report() and
>>> exit(), because that's more obvious.
>>> Likewise, don't error_setg(&error_abort, ...), use assert().
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>> hw/block/fdc.c | 9 +--------
>>> 1 file changed, 1 insertion(+), 8 deletions(-)
>>>
>>> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
>>> index cd29e27d8f..7c1c57f57f 100644
>>> --- a/hw/block/fdc.c
>>> +++ b/hw/block/fdc.c
>>> @@ -396,16 +396,9 @@ static int pick_geometry(FDrive *drv)
>>> nb_sectors,
>>> FloppyDriveType_str(parse->drive));
>>> }
>>> + assert(type_match != -1 && "misconfigured fd_format");
>>> match = type_match;
>>> }
>>> -
>>> - /* No match of any kind found -- fd_format is misconfigured, abort. */
>>> - if (match == -1) {
>>> - error_setg(&error_abort, "No candidate geometries present in table "
>>> - " for floppy drive type '%s'",
>>> - FloppyDriveType_str(drv->drive));
>>> - }
>>> -
>>> parse = &(fd_formats[match]);
>>>
>>> out:
>>>
>>
>> Truthfully sad to see the lipstick go, because this is my pig.
>> Oh well, it doesn't matter. Not really, anyway.
>>
>> ACK
>
> There's still a bit of lipstick in assert()'s argument.
>
> v1 has the error_report() lipstick. Would you like me to merge that one
> instead? Your pig, your choice :)
>
In the end I trust your judgement. I like the more verbose error message
because it tells you precisely what's going on. I like the assert
because it tells you WHERE in the code you've messed up.
I am often very keen on making things more usable and less tersely
worded. I think you favor some of the same things, but with years more
experience than I have.
So I defer to you; after all -- they're just pigs :)
--js
next prev parent reply other threads:[~2018-06-08 15:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 14:46 [Qemu-devel] [PATCH v2 0/4] qapi/error: converts error_setg(&error_fatal) to error_report() + exit() Philippe Mathieu-Daudé
2018-06-07 14:46 ` [Qemu-devel] [PATCH v2 1/4] hw/block/fdc: Replace error_setg(&error_abort) by assert() Philippe Mathieu-Daudé
2018-06-07 17:18 ` John Snow
2018-06-08 6:05 ` Markus Armbruster
2018-06-08 15:03 ` John Snow [this message]
2018-06-07 14:46 ` [Qemu-devel] [PATCH v2 2/4] hw/ppc/spapr_drc: Replace error_setg(&error_abort) by abort() Philippe Mathieu-Daudé
2018-06-08 3:03 ` David Gibson
2018-06-08 3:54 ` Philippe Mathieu-Daudé
2018-06-08 4:23 ` David Gibson
2018-06-08 6:22 ` Markus Armbruster
2018-06-07 14:46 ` [Qemu-devel] [PATCH v2 3/4] hw/arm/sysbus-fdt: Replace error_setg(&error_fatal) by error_report() + exit() Philippe Mathieu-Daudé
2018-06-08 6:27 ` Markus Armbruster
2018-06-21 11:14 ` Philippe Mathieu-Daudé
2018-06-07 14:46 ` [Qemu-devel] [PATCH v2 4/4] device_tree: " Philippe Mathieu-Daudé
2018-06-08 3:04 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45a8a086-a04b-bc54-31a1-570521c657cf@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).