From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu531-0006fN-Hc for qemu-devel@nongnu.org; Wed, 04 Nov 2015 15:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zu52y-0006YA-A6 for qemu-devel@nongnu.org; Wed, 04 Nov 2015 15:52:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu52y-0006Y6-34 for qemu-devel@nongnu.org; Wed, 04 Nov 2015 15:52:44 -0500 References: <1446052473-19170-1-git-send-email-eblake@redhat.com> <1446052473-19170-11-git-send-email-eblake@redhat.com> <87a8qv2awz.fsf@blackfin.pond.sub.org> <56390423.90606@redhat.com> <87oaf9kazf.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <563A7016.2070908@redhat.com> Date: Wed, 4 Nov 2015 13:52:38 -0700 MIME-Version: 1.0 In-Reply-To: <87oaf9kazf.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FfdA3wKmeupwmP8vbwvxrG4QSTdPqc8Gh" Subject: Re: [Qemu-devel] [PATCH v8 10/17] 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) --FfdA3wKmeupwmP8vbwvxrG4QSTdPqc8Gh Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/04/2015 09:03 AM, Markus Armbruster wrote: > Conclusions: >=20 > * Having two different name manglers is a headache we could do without,= > especially since the second one camel_to_upper() is pretty magic. >=20 > We have it only to get >=20 > typedef enum BlockDeviceIoStatus { > BLOCK_DEVICE_IO_STATUS_OK =3D 0, > BLOCK_DEVICE_IO_STATUS_FAILED =3D 1, > BLOCK_DEVICE_IO_STATUS_NOSPACE =3D 2, > BLOCK_DEVICE_IO_STATUS_MAX =3D 3, > } BlockDeviceIoStatus; >=20 > instead of >=20 > typedef enum BlockDeviceIoStatus { > BlockDeviceIoStatus_ok =3D 0, > BlockDeviceIoStatus_failed =3D 1, > BlockDeviceIoStatus_nospace =3D 2, > BlockDeviceIoStatus_MAX =3D 3, > } BlockDeviceIoStatus; >=20 > Bah! CODING_STYLE doesn't even ask for shouting enumeration > constants. Can't see why we do. Interesting idea. In fact, if we went one step further: BlockDeviceIoStatus_ok =3D 0, =2E.. BlockDeviceIoStatusMAX =3D 3. (that is, typename + '_' + value for user values, and typename + 'MAX' for the sentinel), then the max value _cannot_ collide with any of the other values. >=20 > * Keeping the complexity of the rules under control is good both for > qapi.py and for the QAPI schema language. >=20 > To that end, I think we should consider reserving the same set of > names both for members and tag values. It gets rid of complications > like enumerations you can't use as flat union tags. >=20 > Additionally, the question whether to keep the door open for > generating an enum for the alternate cases becomes moot. >=20 > What do you think? I like the idea. Don't know if it's too late for 2.5, though. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FfdA3wKmeupwmP8vbwvxrG4QSTdPqc8Gh 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/ iQEcBAEBCAAGBQJWOnAWAAoJEKeha0olJ0NqsHsIAJxyZhDZ1vdrHeHtkieTbxsh A6BSTWYLZQUGzCNn+y7nzxZzwo7lP378xPfPEJTy4i5als9IXL4p7jmr8aM0CekP e7NMeg3ALCfn2dgXykejbIlNMK+/QE4YOZPUMAMPQTNO8/emSgM9xxUQl12r8CYi uXU0x2XIVsi0jKYMVPFRYLRfjex9Rwfy8tbgNbJe8bz0iZfQismjGSudoUKKLmbY 2bSY0Gr13qijeyWHTi3D0HMema08UbbgGF5+UNvo06LsKcM674fr9W59gZF163tS hbwE7VdUi+IxfO3eFAv07AHylLW6QBB5tCuinJ3QiyKjR8eAPoXGy3vDAU1hYBg= =KAQc -----END PGP SIGNATURE----- --FfdA3wKmeupwmP8vbwvxrG4QSTdPqc8Gh--