Received: from eggs.gnu.org ([2001:4830:134:3::10]:34921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQDkV-0000RL-6g for qemu-devel@nongnu.org; Mon, 01 Feb 2016 07:38:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQDkR-0002Fb-3A for qemu-devel@nongnu.org; Mon, 01 Feb 2016 07:38:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQDkQ-0002FF-UH for qemu-devel@nongnu.org; Mon, 01 Feb 2016 07:38:27 -0500 From: Markus Armbruster References: <1454075341-13658-1-git-send-email-eblake@redhat.com> <1454075341-13658-13-git-send-email-eblake@redhat.com> Date: Mon, 01 Feb 2016 13:38:23 +0100 In-Reply-To: <1454075341-13658-13-git-send-email-eblake@redhat.com> (Eric Blake's message of "Fri, 29 Jan 2016 06:48:48 -0700") Message-ID: <87zivk61xc.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v10 12/25] qapi-visit: Kill unused visit_end_union() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, Michael Roth Eric Blake writes: > The generated code can call visit_end_union() without having called > visit_start_union(). Example: > > if (!*obj) { > goto out_obj; > } > visit_type_CpuInfoBase_fields(v, (CpuInfoBase **)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)->arch) { > [...] > } > 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, by deleting the function as useless. This creates an asymmetry between this and the other start_*()s. but it's only temporary: start_union() will go away in "qapi: Rework deallocation of partial struct" (not in this series). Okay. > Messed up since we have visit_end_union (commit cee2ded). > > Signed-off-by: Markus Armbruster > Message-Id: <1453902888-20457-3-git-send-email-armbru@redhat.com> > [expand scope of patch to delete rather than repair] > Signed-off-by: Eric Blake > > --- > v10: new patch; take Markus' commit message as a starting point (hence > his S-o-b), but rewrite the patch and claim ownership Patch looks good.