qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] qapi: Add comments to aid debugging generat


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/2] qapi: Add comments to aid debugging generated introspection
Date: Tue, 03 Jul 2018 07:38:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> 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.

So far, to_qlit() is completely oblivious of the schema; it just
crunches JSON.  I'd like to keep it that way, if practical.

>> 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).

It's a lovely improvement for developers, but it'll be just as lovely in
3.1 :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]