[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qapi-visit: Clean up code generated around
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qapi-visit: Clean up code generated around visit_end_union() |
Date: |
Wed, 27 Jan 2016 07:02:58 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 01/27/2016 06:54 AM, Markus Armbruster wrote:
> The generated code can call visit_end_union() without having called
> visit_start_union(). Example:
>
> if (!*obj) {
> goto out_obj;
> }
> visit_type_BlockdevOptions_fields(v, obj, &err);
> if (err) {
> goto out_obj; // if we go from here...
> }
> if (!visit_start_union(v, !!(*obj)->u.data, &err) || err) {
> goto out_obj;
> }
> switch ((*obj)->driver) {
> [...]
> }
> out_obj:
> // ... then *obj is true, and ...
> error_propagate(errp, err);
> err = NULL;
> if (*obj) {
> // we end up here
> visit_end_union(v, !!(*obj)->u.data, &err);
> }
> error_propagate(errp, err);
>
> Harmless only because no visitor implements end_union(). Clean it up
> anyway.
I plan on deleting visit_end_union() anyways (and visit_start_union);
see 32/37, plus the FIXME comments added in 21/37. Maybe it's easier to
just delete this incorrect and unused callback earlier in the series,
using your commit message as additional rationale why it is worthless,
and leaving only visit_start_union() cleanups for 32/37.
>
> Messed up since we have visit_end_union (commit cee2ded).
Indeed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v9 18/37] qapi: Drop unused error argument for list and implicit struct, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 17/37] qapi: Drop unused 'kind' for struct/enum visit, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 29/37] qapi: Eliminate empty visit_type_FOO_fields, Eric Blake, 2016/01/19
[Qemu-devel] [PATCH v9 27/37] qapi: Add type.is_empty() helper, Eric Blake, 2016/01/19