From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2BHv-00042n-M3 for qemu-devel@nongnu.org; Fri, 27 Nov 2015 00:09:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2BHs-0000QZ-Ec for qemu-devel@nongnu.org; Fri, 27 Nov 2015 00:09:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2BHs-0000Ps-6W for qemu-devel@nongnu.org; Fri, 27 Nov 2015 00:09:36 -0500 References: <1448040300-968-1-git-send-email-eblake@redhat.com> <1448040300-968-4-git-send-email-eblake@redhat.com> <87ziy0stjx.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <5657E589.1060901@redhat.com> Date: Thu, 26 Nov 2015 22:09:29 -0700 MIME-Version: 1.0 In-Reply-To: <87ziy0stjx.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KRknNAvO1nJ1I5oG7AVmv48hFMFkxA55b" Subject: Re: [Qemu-devel] [PATCH v13 03/14] qapi: Convert QType into QAPI built-in enum type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Michael Roth , qemu-devel@nongnu.org, Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KRknNAvO1nJ1I5oG7AVmv48hFMFkxA55b Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/26/2015 07:51 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> What's more meta than using qapi to define qapi? :) >> >> Convert QType into a full-fledged[*] builtin qapi enum type, so >> that a subsequent patch can then use it as the discriminator >> type of qapi alternate types. Fortunately, the judicious use of >> 'prefix' in the qapi definition avoids churn to the spelling of >> the enum constants. >> >> #include >> #include >> +#include "qapi-types.h" >=20 > Needed for QType. Risk for circular inclusion. We're currently fine, > because generated qapi-types.h includes only "qemu/typedefs.h" (visible= > below). Should we add a comment to qapi-types.py? How about this: @@ -323,6 +319,7 @@ fdef.write(mcgen(''' ''', prefix=3Dprefix)) +# To avoid circular headers, use only typedefs.h here, not qobject.h fdecl.write(mcgen(''' #include #include -#include "qapi/qmp/qobject.h" +#include "qemu/typedefs.h" ''')) schema =3D QAPISchema(input_file) >> def visit_enum_type(self, name, info, values, prefix): >> - self._fwdecl +=3D gen_enum(name, values, prefix) >> - self._fwdefn +=3D gen_enum_lookup(name, values, prefix) >> + # Special case for our lone builtin enum type >> + # TODO use something cleaner than existence of info >> + if not info: >> + self._btin +=3D gen_enum(name, values, prefix) >> + if do_builtins: >> + self.defn +=3D gen_enum_lookup(name, values, prefix) >> + else: >> + self._fwdecl +=3D gen_enum(name, values, prefix) >> + self._fwdefn +=3D gen_enum_lookup(name, values, prefix) >=20 > Odd: gen_enum_lookup() goes into .defn for built-ins, but ._fwdefn for > user-defineds. Makes me suspect it ._fwdefn isn't needed anymore. A > quick test compile is happy with .defn for both. >=20 > If we want to keep ._fwdefn for some reason, we should use for built-in= s > as well. We need it for gen_alternate_qtypes(). But that disappears in 4/14, so I'll add a patch to clean it up. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --KRknNAvO1nJ1I5oG7AVmv48hFMFkxA55b 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/ iQEcBAEBCAAGBQJWV+WJAAoJEKeha0olJ0NqIk0H/3VaKXMjyqNo8id7Q1vrXdaK qZgy8Fxd8ai6JeqiLc1l6FhxLZrDaYgTrxMUjihxHpxJSATyAcOiwVVw5v7f2xq2 hwSIjdqZTsac6vekNbBPsntZiv0FcrysmKh30UuDBA4S7VhjhRdG2E2yoaWiIXFU Fgux94AaOkjcDLTulyVOhpAu79DjOZbPi3R9vRK8++X0of+KcStJbdTNMOweipRO bu5f0i891fwCXxyecNjd6mFg057H1539gU1ojdHGYGJ2WNOt5nXBdnPTCNeIigFr nvZ8Uyk1caKoXw84Q5CN0oPIQgCY5EBu3sf9G2KeO16GrG6ZsJ8q9Ck8na4hN5U= =zQIR -----END PGP SIGNATURE----- --KRknNAvO1nJ1I5oG7AVmv48hFMFkxA55b--