From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZejR3-0001RU-0N for qemu-devel@nongnu.org; Wed, 23 Sep 2015 08:46:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZejQy-0000bo-2J for qemu-devel@nongnu.org; Wed, 23 Sep 2015 08:46:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZejQx-0000b0-RR for qemu-devel@nongnu.org; Wed, 23 Sep 2015 08:46:04 -0400 References: <1442872682-6523-1-git-send-email-eblake@redhat.com> <1442872682-6523-4-git-send-email-eblake@redhat.com> <87h9mmfpf7.fsf@blackfin.pond.sub.org> <5601955B.4050109@redhat.com> <87a8sda2t8.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56029F04.3040407@redhat.com> Date: Wed, 23 Sep 2015 06:45:56 -0600 MIME-Version: 1.0 In-Reply-To: <87a8sda2t8.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9WTmpWn8dBBNboS4gJRt0UKbhQQQj6VJR" Subject: Re: [Qemu-devel] [PATCH v5 03/46] qapi: Test for C member name collisions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Michael Roth , marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com, DirtY.iCE.hu@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9WTmpWn8dBBNboS4gJRt0UKbhQQQj6VJR Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/23/2015 03:43 AM, Markus Armbruster wrote: >> Commit 1e6c1616 was where we quit burning the C member name 'base'. >> Prior to that time, members of base classes did not clash with variant= >> names because of the C boxing. >=20 > For union types. For struct types, we still box the base. I'd like to= > get rid of that. Patch 34/46 :) >=20 > Even when the base is boxed, the members still clash in QMP. >=20 > We also box the variants (e.g. UserDefA *value1 in the example above). > Would be nice to get rid of that, too. What do you mean? Here's an example of current boxed code: enum EnumType { ENUM_TYPE_ONE, ENUM_TYPE_TWO, }; struct One { int a; }; struct Two { char *a; }; struct Union { EnumType type; /* union tag is @type */ union { One *one; Two *two; }; }; Is this what you envision for unboxed? Note that we still have to namespace things properly (we have to have union.one.a and union.two.a, and not a direct union.a), so all we'd be saving is the additional allocation of the variant pointers. struct Union { EnumType type; /* union tag is @type */ union { struct { int a; } one; struct { char *a; } two; }; }; However, I'm not sure it would always help. The conversion of netdev_add to full qapi relies on being able to access the variant through a named struct (such as NetdevTapOptions); unboxing the variant would get rid of the convenient access to these named sub-structs. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --9WTmpWn8dBBNboS4gJRt0UKbhQQQj6VJR 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/ iQEcBAEBCAAGBQJWAp8EAAoJEKeha0olJ0Nqx/wIAKIsbaJXvdzDlO9Qi7+iqik2 QVsvDgrL/XRu7pBMnOzLSNWKsCmIeM0glKSqWFhOf2ujgrLbmnF07xjOnaGhJXGC XDVtelu2+SDc8YcEX6vB4tDNtWRI6Nn6I5ezfzWjurxKRTXZkWkJb88PnKvTJYH/ WrZpes6UErRJwChtUOWt3SZo0cwz2TYPbnWkIagAVkC2ZKBLoAbA+vrkouExCQiG l1AkSTh1/losLomUXYmMk3mwSTJmIhqMAnlJu/JKjUIi9HIXnkgDwd73q4Py/Ag5 ei0QYjkgrdvUhBShzMqL0yrIX1lYfnNH0zrrqx+dWbxm0i09ZUvwG5AmfBzB/EQ= =t/21 -----END PGP SIGNATURE----- --9WTmpWn8dBBNboS4gJRt0UKbhQQQj6VJR--