From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
Anthony Liguori <aliguori@amazon.com>,
Cole Robinson <crobinso@redhat.com>
Subject: Re: [Qemu-devel] Error propagation in generated visitors and command marshallers
Date: Wed, 09 Apr 2014 10:34:24 -0600 [thread overview]
Message-ID: <53457690.8010009@redhat.com> (raw)
In-Reply-To: <871tx6zeoz.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]
On 04/09/2014 09:48 AM, Markus Armbruster wrote:
> I stumbled over this while trying to purge error_is_set() from the code.
>
> But: is it a good idea to have both patterns in the code? Should we
> perhaps use the common pattern for visiting, too? Like this:
>
> visit_type_str(v, &foo, "foo", &err);
> if (err) {
> goto out;
> }
> visit_type_str(v, &bar, "bar", &err);
> if (err) {
> goto out;
> }
>
> Then we can assume *errp is clear on function entry, like this:
>
> void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp)
> {
> v->type_str(v, obj, name, errp);
> }
>
> Should execute roughly the same number of conditional branches.
>
> Tedious repetition of "if (err) goto out" in the caller, but that's what
> we do elsewhere, and unlike elsewhere, these one's are generated.
>
> Opinions?
Putting the tedium into the generated code is WHY we have generated
code; so that the rest of the code that is hand-written can be concise.
I like this latter idea of letting the visitors assume that errp is
clean on entry with the caller responsible for checking err after each step.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-04-09 16:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 15:48 [Qemu-devel] Error propagation in generated visitors and command marshallers Markus Armbruster
2014-04-09 16:34 ` Eric Blake [this message]
2014-04-09 16:36 ` Anthony Liguori
2014-04-11 8:20 ` Markus Armbruster
2014-04-09 17:23 ` Dr. David Alan Gilbert
2014-04-11 8:24 ` Markus Armbruster
2014-04-11 8:37 ` Dr. David Alan Gilbert
2014-04-10 11:24 ` Kevin Wolf
2014-04-11 8:28 ` Markus Armbruster
2014-04-11 10:10 ` Kevin Wolf
2014-04-11 11:59 ` Peter Crosthwaite
2014-04-11 13:41 ` Markus Armbruster
2014-04-11 22:46 ` 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=53457690.8010009@redhat.com \
--to=eblake@redhat.com \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=crobinso@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.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.