From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIPmo-0003ss-0l for qemu-devel@nongnu.org; Thu, 23 Jul 2015 19:20:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIPmk-0000gZ-HC for qemu-devel@nongnu.org; Thu, 23 Jul 2015 19:20:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIPmk-0000gN-9W for qemu-devel@nongnu.org; Thu, 23 Jul 2015 19:20:18 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-45-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B176AA.3050300@redhat.com> Date: Thu, 23 Jul 2015 17:20:10 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-45-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UehTg90w8MdDEpgf4CjNjPW95u9tTjENe" Subject: Re: [Qemu-devel] [PATCH RFC v2 44/47] qapi: Pseudo-type '**' is now unused, drop it 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) --UehTg90w8MdDEpgf4CjNjPW95u9tTjENe Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:22 PM, Markus Armbruster wrote: > 'gen': false needs to stay for now, because netdev_add is still using > it. >=20 > Signed-off-by: Markus Armbruster > --- > docs/qapi-code-gen.txt | 15 ++++--------= --- > scripts/qapi.py | 20 ++++--------= -------- > tests/Makefile | 4 ++-- > tests/qapi-schema/args-returns-any.err | 1 + > ...type-bypass-no-gen.exit =3D> args-returns-any.exit} | 0 >=20 > diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt > index 2367c66..ca578dd 100644 > --- a/docs/qapi-code-gen.txt > +++ b/docs/qapi-code-gen.txt > @@ -457,13 +454,9 @@ which would validate this Client JSON Protocol tra= nsaction: > =20 > In rare cases, QAPI cannot express a type-safe representation of a > corresponding Client JSON Protocol command. In these cases, if the > -command expression includes the key 'gen' with boolean value false, > -then the 'data' or 'returns' member that intends to bypass generated > -type-safety and do its own manual validation should use an inline > -dictionary definition, with a value of '**' rather than a valid type > -name for the keys that the generated code will not validate. Please > -try to avoid adding new commands that rely on this, and instead use > -type-safe unions. For an example of bypass usage: > +command expression includes the key 'gen' with boolean value false. Incomplete sentence. "if the command expression includes... false" needs "then something...". > +Please try to avoid adding new commands that rely on this, and instead= > +use type-safe unions. For an example of bypass usage: And given my ideas, we may be able to make netdev_add typesafe and eliminate 'gen' altogether in the future :) > +++ b/tests/Makefile > @@ -222,11 +222,11 @@ check-qapi-schema-y :=3D $(addprefix tests/qapi-s= chema/, \ > bad-type-dict.json double-data.json unknown-expr-key.json \ > redefined-type.json redefined-command.json redefined-builtin.json \ > redefined-event.json command-int.json bad-data.json event-max.json \ > - type-bypass.json type-bypass-no-gen.json type-bypass-bad-gen.json \ > + type-bypass-bad-gen.json \ If I understand correctly (git didn't quite guess right), type-bypass-no-gen.json disappears completely (we no longer have working '**'), and type-bypass.json... > data-array-empty.json data-array-unknown.json data-int.json \ > data-unknown.json data-member-unknown.json data-member-array.json \ > data-member-array-bad.json args-union.json args-alternate.json \ > - returns-array-bad.json returns-int.json \ > + args-returns-any.json returns-array-bad.json returns-int.json \ =2E..gets renamed args-returns-any.json (because type bypass is now expressed via 'any'. > +# built-in type 'any' in arguments and returns > +# works except for 'data': 'any', because that has to be a struct > +# note: command name 'qom-get' chosen to avoid "cannot use built-in" e= rror > +{ 'command': 'qom-get', 'data': { 'arg': 'any' }, 'returns': 'any' } > +{ 'command': 'foo', 'returns': { 'arg': 'any' } } > +{ 'command': 'bar', 'data': 'any' } This shows what the parser accepts and rejects, but doesn't prove it compiles to C; and the previous patch that touched test-qmp-input-visitor.c was testing that the low-level interactions worked but did not map it all the way back to qapi. I wonder if you should also enhance qapi-schema-test to use 'any', since that tends to be the one test that most fully exercises interactions with generated code based on a valid qapi schema. On the right track, but I want to make sure the botched documentation is correct before giving R-b. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --UehTg90w8MdDEpgf4CjNjPW95u9tTjENe 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/ iQEcBAEBCAAGBQJVsXaqAAoJEKeha0olJ0NqlwQH+wZBfsq1Pm5eRFI/J2vRnCnx 0zce8SRYPSUQAA/s0WcgRuaW26p2dWlIQJ5OA0H1cvrKAT7ZvZ5f+5zLSfl0p7Bb nIJ4UBq0GG3wksWypT6fkdyTqku1TCAYqEijBVW8gmEIUjWwfTFi0bS3kH10UcNO p3azIyYLJ/xEmbDJZS36Oe5banOrQgOLvAw59maSYcEQgQAjweifM1yWmfWKksFR 0V8OR6M42i6OyqNC6e7KkWE91A8ODTFjeQvwS9KRR+HUYnPvNUGeNU6tLuq7SW99 Rwsod8DtDq+W5Z/h7Wk3XYXDU5B+r2HRMCYmMsn0r1fRQEhJFp7tmZ4ei0LxJNU= =AypJ -----END PGP SIGNATURE----- --UehTg90w8MdDEpgf4CjNjPW95u9tTjENe--