[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 08/37] qapi: Track all failures between visit
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v9 08/37] qapi: Track all failures between visit_start/stop |
Date: |
Wed, 20 Jan 2016 10:15:59 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 01/20/2016 09:03 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> Inside the generated code between visit_start_struct() and
>> visit_end_struct(), we were blindly setting the error into
>> the caller's errp parameter. But a future patch to split
>> visit_end_struct() will require that we take action based
>> on whether an error has occurred, which requires us to track
>> all actions through a local err. Rewrite the visits to be
>> more in line with the other generated calls.
>>
>> |+ if (!*obj) {
>
> err is clear here.
>
>> |+ goto out_obj;
>> |+ }
>> |+ visit_type_GuestAgentCommandInfo_fields(v, obj, &err);
>> |+out_obj:
>> |+ error_propagate(errp, err);
>> |+ err = NULL;
>
> If we come from goto out_obj, these two lines are no-ops.
I could move the label, if desired...
>
>> |+ visit_end_struct(v, &err);
>> |+out:
>> | error_propagate(errp, err);
>> | }
>
> gen_visit_union(), the other generator of visit_start_struct(), already
> does it this way. It generates additional goto out_obj, so the
> placement of out_obj makes more sense there. I guess we want to place
> it in the same spot here to facilitate unifying the two.
...but as you observed, the unification in 31 is a bit easier with it
placed identically. Maybe a commit message comment is in order.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v9 10/37] qapi: Make all visitors supply uint64 callbacks, (continued)
[Qemu-devel] [PATCH v9 11/37] qapi: Consolidate visitor small integer callbacks, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 08/37] qapi: Track all failures between visit_start/stop, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 09/37] qapi: Prefer type_int64 over type_int in visitors, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 20/37] qmp: Don't abuse stack to track qmp-output root, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 21/37] qapi: Document visitor interfaces, add assertions, Eric Blake, 2016/01/19