From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: imammedo@redhat.com,
Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
pbonzini@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v2 1/6] error: Add error_abort
Date: Fri, 06 Dec 2013 12:59:36 +0100 [thread overview]
Message-ID: <87pppai40n.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <52A07DF0.3010408@redhat.com> (Eric Blake's message of "Thu, 05 Dec 2013 06:21:52 -0700")
Eric Blake <eblake@redhat.com> writes:
> On 12/05/2013 03:13 AM, Markus Armbruster wrote:
>
>>>
>>> For error_propagate, if the destination error is &error_abort, then
>>> the abort happens at propagation time.
>>>
>>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> ---
>>> changed since v1:
>>> Delayed assertions that *errp == NULL.
>>
>> Care to explain why you want to delay these assertions? I'm not sure I
>> get it...
>
> error_abort as a global variable is always NULL.
>
>>
>> [...]
>>> @@ -31,7 +33,6 @@ void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...)
>>> if (errp == NULL) {
>>> return;
>>> }
>>> - assert(*errp == NULL);
>
> So *&error_abort is null and this assertion would fire, unless we delay
> the check for NULL...
Err, one of us is confused :)
When errp == &error_abort, then *errp should be null. If it isn't, then
something got stored in error_abort, which is quite wrong. Leaving the
assertion where it is catches that.
>>>
>>> err = g_malloc0(sizeof(*err));
>>>
>>> @@ -40,6 +41,12 @@ void error_set(Error **errp, ErrorClass
>>> err_class, const char *fmt, ...)
>>> va_end(ap);
>>> err->err_class = err_class;
>>>
>>> + if (errp == &error_abort) {
>>> + error_report("%s", error_get_pretty(err));
>>> + abort();
>>> + }
>>> +
>>> + assert(*errp == NULL);
>
> ...until after the check for &error_abort.
next prev parent reply other threads:[~2013-12-06 12:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 0:47 [Qemu-devel] [PATCH v2 0/6] Add error_abort and associated cleanups Peter Crosthwaite
2013-12-05 0:48 ` [Qemu-devel] [PATCH v2 1/6] error: Add error_abort Peter Crosthwaite
2013-12-05 10:13 ` Markus Armbruster
2013-12-05 13:21 ` Eric Blake
2013-12-06 11:59 ` Markus Armbruster [this message]
2013-12-06 12:43 ` Peter Crosthwaite
2013-12-06 13:16 ` Markus Armbruster
2013-12-05 0:49 ` [Qemu-devel] [PATCH v2 2/6] hw/core/qdev: Delete dead code Peter Crosthwaite
2013-12-05 0:49 ` [Qemu-devel] [PATCH v2 3/6] hw: Remove assert_no_error usages Peter Crosthwaite
2013-12-05 0:50 ` [Qemu-devel] [PATCH v2 4/6] target-i386: Remove assert_no_error usage Peter Crosthwaite
2013-12-05 0:50 ` [Qemu-devel] [PATCH v2 5/6] qemu-option: Remove qemu_opts_create_nofail Peter Crosthwaite
2013-12-05 10:11 ` Markus Armbruster
2013-12-11 3:34 ` Peter Crosthwaite
2013-12-05 0:51 ` [Qemu-devel] [PATCH v2 6/6] qerror: Remove assert_no_error() Peter Crosthwaite
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=87pppai40n.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=eblake@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.