On 07/03/2018 12:51 AM, Markus Armbruster wrote:
Eric Blake <[email protected]> writes:
On 07/02/2018 01:48 PM, Markus Armbruster wrote:
Eric Blake <[email protected]> writes:
Now that we have useful access to the type name as a comment
in the generated qapi-introspect.c, we don't need to regenerate
code with a temporary -u option just to get at type names.
# three lines: greeting, output of qmp_capabilities, query-qmp-schema
return json.loads(out.split('\n')[2])['return']
This returns an abstract syntax tree, represented in Python the obvious
way. I can then explore it in Python, say search for object types with
certain properties. For example, commit 2860b2b2cb8:
Thus, the flaw puts an artificial restriction on the QAPI schema: we
can't have potentially empty objects and arrays within
BlockdevOptions, except when they're optional and "empty" has the same
meaning as "absent".
--> Our QAPI schema satisfies this restriction (I checked), but it's a
trap for the unwary, and a temptation to employ awkward workarounds
for the wary. Let's get rid of it.
I checked with a Python script that read the schema as shown above.
Without -u, I'd have to revert the identifier hiding. I could certainly
write some more Python to read the mapping from the generated C, but
that feels like busy work.
Good argument. Okay, I'm dropping this patch, and tweaking the other
patch commit message to explain that -u is still useful, even with the
addition of comment aids.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org