qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 00/30] qapi: Elide redundant has_FOO in generated C


From: Markus Armbruster
Subject: Re: [PATCH v3 00/30] qapi: Elide redundant has_FOO in generated C
Date: Fri, 04 Nov 2022 17:15:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Markus Armbruster <armbru@redhat.com> writes:

> In QAPI, absent optional members are distinct from any present value.
> We thus represent an optional schema member FOO as two C members: a
> FOO with the member's type, and a bool has_FOO.  Likewise for function
> arguments.
>
> However, the has_FOO is actually redundant for a pointer-valued FOO,
> which can be null only when has_FOO is false, i.e. has_FOO == !!FOO.
> Except for arrays, where we a null FOO can also be a present empty
> array.
>
> The redundant has_FOO are a nuisance to work with.  Improve the
> generator to elide them.
>
> PATCH 01+02 are trivial documentation cleanups.
>
> PATCH 03 tweaks an example in documentation so it'll show the change.
>
> PATCH 04 improves the code generator, but nerfs the change for the
> schema modules where handwritten code needs to be updated.
>
> PATCH 05-07,10-29 un-nerf in reviewable chunks.  Their commit messages
> refer back to PATCH 04 for an explanation of the transformation.
> Please read that first.  Note that these patches combine the
> mechanical transformation with obvious, local follow-up
> simplifications.  If you want them separate for easier review, let me
> know.
>
> PATCH 08+09 clean up in preparation for PATCH 10.
>
> PATCH 28 drops the nerfing code.

PATCH 30, of course.




reply via email to

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