Message ID | 20221104160712.3005652-1-armbru@redhat.com |
---|---|
Headers | show |
Series | qapi: Elide redundant has_FOO in generated C | expand |
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.