From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi02K-0007PO-1a for qemu-devel@nongnu.org; Fri, 02 Oct 2015 09:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi02F-00035E-Ag for qemu-devel@nongnu.org; Fri, 02 Oct 2015 09:06:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi02E-000355-Uw for qemu-devel@nongnu.org; Fri, 02 Oct 2015 09:06:03 -0400 References: <1443760312-656-1-git-send-email-eblake@redhat.com> <1443760312-656-4-git-send-email-eblake@redhat.com> <87pp0xg0eg.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <560E8133.9060805@redhat.com> Date: Fri, 2 Oct 2015 07:05:55 -0600 MIME-Version: 1.0 In-Reply-To: <87pp0xg0eg.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6ieDMwSdEECS5vC1A4RphAQ9iQOqggaE3" Subject: Re: [Qemu-devel] [PATCH v6 03/12] qapi: Lazy creation of array types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6ieDMwSdEECS5vC1A4RphAQ9iQOqggaE3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/02/2015 02:06 AM, Markus Armbruster wrote: > Woot! >=20 > Eric Blake writes: >=20 >> Commit ac88219a had several TODO markers about whether we needed >> to automatically create the corresponding array type alongside >> any other type. It turns out that most of the time, we don't! >> >> As part of lazy creation of array types, this patch now assigns >> an 'info' to array types at their point of first instantiation, >> rather than leaving it None. >=20 > I guess our general for info should be: s/general/general description/ ? >=20 > For explicitly defined entities, info points to the (explicit) > definition. For implicitly defined entities, it points to a place that= > triggers implicit definition. For some kinds of entities, multiple > places may exist, and info points to one of them. >=20 Right now, we don't document any of the fields, but I can certainly add that comment. >=20 > Here, you're talking about the effect on generated code. I'd put the > specific case of introspection last, in a paragraph of its own. >=20 Improving the commit message is easier than redoing bad code :) >> +++ b/qapi-schema.json >> @@ -3396,6 +3396,16 @@ >> 'features': 'int' } } >> >> ## >> +# @Dummy >> +# >> +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList inter= nally >> +# >> +# Since 2.5 >> +## >> +{ 'struct': 'Dummy', 'data': { 'unused': ['X86CPUFeatureWordInfo'] } = } >=20 > DummyToForceArrays? Sure. >=20 >> + >> + >> +## >> # @RxState: >> # >> # Packets receiving state >> diff --git a/scripts/qapi.py b/scripts/qapi.py >> index 8123ab3..15640b6 100644 >> --- a/scripts/qapi.py >> +++ b/scripts/qapi.py >> @@ -1143,7 +1143,7 @@ class QAPISchema(object): >> def _def_builtin_type(self, name, json_type, c_type, c_null): >> self._def_entity(QAPISchemaBuiltinType(name, json_type, >> c_type, c_null)) >> - self._make_array_type(name) # TODO really needed? >> + self._make_array_type(name, None) >=20 > Should we keep a TODO here? Sure, with better text explaining the guard issue on types shared in multiple qapi-types.h files. >> typ =3D self._make_implicit_object_type(typ, 'wrapper', >> - [self._make_member('dat= a', typ)]) >> + [self._make_member('dat= a', typ, >> + info= )]) >=20 > Consider a hanging indent here: >=20 > typ =3D self._make_implicit_object_type( > typ, 'wrapper', [self._make_member('data', typ, inf= o)]) Okay. pep8 and pylint like it (I'm not used to doing it, but it does look better, and emacs didn't fight me too hard). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --6ieDMwSdEECS5vC1A4RphAQ9iQOqggaE3 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/ iQEcBAEBCAAGBQJWDoEzAAoJEKeha0olJ0Nq9WIH/12jma2E8aDsl6NB1iR8VExl tHaDB4PooV6osPA5xox9N1sYo92Bj/do92n0aaFT5k87pXaPfPgFam4c78A/jQSm jAmBYz+dybAsqVkjEjU/WNOWXmLOFHKUQwbMbnYchmXXO3l7HSXHQw1NuQyOsExB Qw5a2rgWJ+hzd7W2CUmyNIZg4TYMh2Nu+QZMJ4PI65gu+OC9oPW8MXNkQcE/tt3j LiYXedDu73AYvny0EJGEfHn5wc6ACW+UnZt+Ai6yaXj5qTOKAijCa1viWBxuq4pQ vSrD4YMGdS4m1ZeO5k5FfJ1SiH3IYoZgrLjNcr7Z50cIyeCLztTBux0aamVOj48= =Nek+ -----END PGP SIGNATURE----- --6ieDMwSdEECS5vC1A4RphAQ9iQOqggaE3--