From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKBBZ-0000aA-1L for qemu-devel@nongnu.org; Tue, 28 Jul 2015 16:09:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKBBU-0003rv-ST for qemu-devel@nongnu.org; Tue, 28 Jul 2015 16:09:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKBBU-0003rI-Mo for qemu-devel@nongnu.org; Tue, 28 Jul 2015 16:09:08 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-8-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B7E15D.50902@redhat.com> Date: Tue, 28 Jul 2015 14:09:01 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-8-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WnTLAMJrcxcQwIJvgLGEh7tI3DOvjLURV" Subject: Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WnTLAMJrcxcQwIJvgLGEh7tI3DOvjLURV Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:21 PM, Markus Armbruster wrote: > The struct generated for a flat union is weird: the members of its > base are at the end, except for the union tag, which is renamed to > 'kind' and put at the beginning. The renaming to 'kind' was a bug waiting to happen. Consider this example, which is broken before your series: diff --git i/tests/qapi-schema/qapi-schema-test.json w/tests/qapi-schema/qapi-schema-test.json index c7eaa86..12c09e3 100644 --- i/tests/qapi-schema/qapi-schema-test.json +++ w/tests/qapi-schema/qapi-schema-test.json @@ -37,7 +37,7 @@ 'data': { 'string1': 'str', 'string2': 'str' } } { 'struct': 'UserDefUnionBase', - 'data': { 'string': 'str', 'enum1': 'EnumOne' } } + 'data': { 'kind': 'str', 'enum1': 'EnumOne' } } { 'union': 'UserDefFlatUnion', 'base': 'UserDefUnionBase', leading to this compilation error during 'make check-unit': In file included from tests/test-qmp-output-visitor.c:17:0: tests/test-qapi-types.h:617:11: error: duplicate member =E2=80=98kind=E2=80= =99 char *kind; ^ tests/test-qapi-types.h:631:11: error: duplicate member =E2=80=98kind=E2=80= =99 char *kind; ^ Therefore, it might be worth mentioning that avoiding the rename to 'kind' is a bug fix, not just a nicer struct :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --WnTLAMJrcxcQwIJvgLGEh7tI3DOvjLURV 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/ iQEcBAEBCAAGBQJVt+FdAAoJEKeha0olJ0NqnbQH/25YiAtWhpvecO7EQD44J7bK E7CjQjIp7csWpwBCx3HHZ+9xvdXLyPQDr0D8N/mCmEEQ6TtycnqzskiFvCWZlDG0 +6FQFvT6YbsJhY2Q/iIw9xrNhsb9P5NaRwG+3thA8/Y++nm+meRZIE2fSHTAGTF0 rJqoQL8PirItEDrXF1mPZpf8aS1t5mBi12gZb/Bc4mV2I7omYkuUkXvb+EUfQYJN EKSqoINwPRS1r6E1G3H0T+DFkd6Q6BSDcWfUYoeRzmy38qO559cOHOWKsOuEZ7WC rbBaEnEiJltiPv8rOxgxjRTIvuEC9CkM3Drv3ibgt96TBDc2YEqR4GopGLAtxYY= =JMjR -----END PGP SIGNATURE----- --WnTLAMJrcxcQwIJvgLGEh7tI3DOvjLURV--