From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz91d-0000d5-IR for qemu-devel@nongnu.org; Wed, 18 Nov 2015 15:08:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz91a-0005yM-DM for qemu-devel@nongnu.org; Wed, 18 Nov 2015 15:08:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz91a-0005y8-7E for qemu-devel@nongnu.org; Wed, 18 Nov 2015 15:08:14 -0500 References: <1447836791-369-1-git-send-email-eblake@redhat.com> <1447836791-369-32-git-send-email-eblake@redhat.com> <874mgjjgbw.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <564CDAAC.3030200@redhat.com> Date: Wed, 18 Nov 2015 13:08:12 -0700 MIME-Version: 1.0 In-Reply-To: <874mgjjgbw.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DfPVrGfwW4kQbqtmSHA3STFrwQMIeKNQW" Subject: Re: [Qemu-devel] [PATCH v12 31/36] qapi: Simplify visiting of alternate types 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) --DfPVrGfwW4kQbqtmSHA3STFrwQMIeKNQW Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/18/2015 11:46 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Previously, working with alternates required two lookup arrays >> and some indirection: for type Foo, we created Foo_qtypes[] >> which maps each qtype to a value of the generated FooKind enum, >> then look up that value in FooKind_lookup[] like we do for other >> union types. >> >> This has a couple of subtle bugs. First, the generator was >> creating a call with a parameter '(int *) &(*obj)->type' where >> type is an enum type; this is unsafe if the compiler chooses >> to store the enum type in a different size than int, where >> assigning through the wrong size pointer can corrupt data or >> cause a SIGBUS. [We still have the casting bug for our enum >> visitors, but that's a topic for a different patch.] >=20 > I'm not sure I get the last sentence. I was referring to our casts of enum types to int* inside visit_type_Enum= (): https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg03408.html If you have a better wording for it, or want to drop the parenthetical altogether, I'm fine. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DfPVrGfwW4kQbqtmSHA3STFrwQMIeKNQW 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/ iQEcBAEBCAAGBQJWTNqsAAoJEKeha0olJ0NqQmIIAI5on7mcEIPWR6unmP4L0gM/ YiJqZcZRA0Eb5ukDCWPWS/mDeNr5LVeLCbUtlloBn3Cu47EAE3d+5frx81IOBEFl gHg5N1ZemEu0ib4SVcSvQOxQ6kod+ckCGD7twmiWtUuGYP3G74oMlYJREPLXJ9y5 D1zGB40O+J7Mxt9qxmaXIRmy2l4GLy2LXlLDcJAOvu9cnz+qNUlmF2woOlgtmu5I 1/wZIKOQKAeZA0iSIObusB9OZ7j+6VYPsGiV76vCwH0vBum2N8pZR0UtVkf2L/oU b/O29NW5GLBTDWCRHBI1a/tD1VhtDK1LL2ab/HodLv4FKWFytopewz6m+wZy030= =NCTT -----END PGP SIGNATURE----- --DfPVrGfwW4kQbqtmSHA3STFrwQMIeKNQW--