|
From: | Eric Blake |
Subject: | Re: [Qemu-devel] [PATCH 1/2] qapi: Add comments to aid debugging generated introspection |
Date: | Mon, 2 Jul 2018 14:59:38 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 07/02/2018 01:43 PM, Markus Armbruster wrote:
Eric Blake <address@hidden> writes:On 06/29/2018 02:55 PM, Eric Blake wrote:We consciously chose in commit 1a9a507b to hide QAPI type names from the generated introspection output, but added a command line option -u to unmask the type name when doing a debug build. At that time, we generated a monolithic C string, so there was no better way to do things (we could not really inject comments). Later, in commit 7d0f982b, we switched the generation to output a QLit object, in part to make it easier for future addition of conditional compilation. But this switch has also made it easier to interject strategic comments. That commit also forgot to delete some now-stale comments about long generated line lengths. For now, type name debug aid comments are only output once per meta-type, rather than at all uses of the number used to encode the type to the introspection data. But this is still a lot more convenient than having to regenerate the file with the unmask operation temporarily turned on....
to_qlit() converts from a natural representation of JSON in Python to JSON text. Your patch breaks it for JSON objects that have a member named 'comment'.
Hmm. None do, presently. And I don't see where it would be permitted in the QAPI schema for query-qmp-schema.
Related work: Marc-André's "[PATCH v6 09/15] qapi-introspect: add preprocessor conditions to generated QLit" uses tuples to augment JSON. He uses them for conditionals, but the technique could be generalized, say from his (jobj, ifcond) to (jobj, { 'if': ifcond, '#': comment }.
Yeah, I can probably rebase on top of that (and at this point, it's late enough to probably have missed 3.0 anyways, so I'm not time-crunched for getting it done right now).
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |