From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWRkD-00075f-Td for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:47:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWRk9-0005CK-SX for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:47:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWRk9-0005C4-Eu for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:47:53 -0500 References: <1455582057-27565-1-git-send-email-eblake@redhat.com> <1455582057-27565-13-git-send-email-eblake@redhat.com> <87vb5np5u7.fsf@blackfin.pond.sub.org> <56C4E3EC.7040800@redhat.com> <87si0ql93h.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56C5F5B7.2050501@redhat.com> Date: Thu, 18 Feb 2016 09:47:51 -0700 MIME-Version: 1.0 In-Reply-To: <87si0ql93h.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="edFMdfvCjBforRTONuRS0aRsmIKPtFxHE" Subject: Re: [Qemu-devel] [PATCH v10 12/13] qapi: Delete unused visit_start_union() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --edFMdfvCjBforRTONuRS0aRsmIKPtFxHE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/18/2016 01:24 AM, Markus Armbruster wrote: >> For simple unions, you could have (well, still can have, until my late= r >> patch gets rid of the simple_union_type() magic): >> >> struct SU { >> SUKind type; >> union { >> void *data; >> int8_t byte; >> } u; >> }; >=20 > Begs the question why that works :) By sheer luck, and (poorly?) documented in a hairy comment in qapi-dealloc-visitor.c (at least, until I delete visit_start_union). We have a data-dependent decision (not only the contents of 'byte', but ALSO the contents of the padding bits), but either the decision results in calling visit_type_int8() (and doing nothing) or skipping the call (and likewise doing nothing). >> I guess I may try and reword this slightly, and point to the fact that= >> the NULL dereference was due to calling visit_start_implicit_FOO() (on= ly >> done for flat unions; for simple unions the branches call >> visit_type_FOO(), and that call safely handled NULL); >=20 > That's why it works? >=20 >> But now that visit_type_implicit_FOO() is gone, my earlier incantation= >> got reduced in size. I guess it's all in how I document the commit me= ssage. >=20 > Give it a try :) I gave it my best in v11 :) Maybe you'll still have wording improvements, but this back-and-forth has helped both of us try to actually characterize what is going on. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --edFMdfvCjBforRTONuRS0aRsmIKPtFxHE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWxfW3AAoJEKeha0olJ0Nqg7wIAKqUv2KOUtdVPPGYBTWrvsi6 NP6UrsFbk4kZX2DKQ4JIXXQ9flrjfIvzAuuqTvfKZoG6CURASibABzOxEqASa7c0 TPnEWF/urAshOciEziuiCktqEHOS/ZaqdyzAfe8aj05loqQxZ8KMouw/L839YTWW qlOHOUOqeGto/o1PGUxeFF7JlZvRF9fOkkuZzURO0vINVeDCX74+N0TGtjh7mwYT 2qFM/i2GAaEXh4fyfWIETh9jDmkq/BYQnFP00ciudJdkQ/ZQX4LP4I+FrBr/p2dm feCoIMIL1odV1JmR09ez4l9r4BNIc6oGXmPzNwPu0QqZIiC3AiEVVbEUHXWuzfU= =5Ruc -----END PGP SIGNATURE----- --edFMdfvCjBforRTONuRS0aRsmIKPtFxHE--