Marc-André Lureau <marcandre.lureau@redhat.com> writes:
> Hi,
>
> The thrid and last part (of "[PATCH v2 00/54] qapi: add #if
> pre-processor conditions to generated code") is about adding schema
> conditions based on the target.
>
> For now, the qapi code is compiled in common objects (common to all
> targets). This makes it impossible to add #if TARGET_ARM for example.
>
> The patch "RFC: qapi: learn to split the schema by 'top-unit'"
> proposes to split the schema by "top-unit", so that generated code can
> be built either in common objects or per-target. That patch is a bit
> rough, I would like to get some feedback about the approach before
> trying to improve it. The following patches demonstrate usage of
> target-based #if conditions, and getting rid of the
> qmp_unregister_command() hack.
Lovely except for the 'top-unit' feature. I believe the existing
modules can do the job. Quoting my "[PATCH v2 00/29] Modularize
generated QAPI code":
Related: Marc-André's 'unit' pragma proposal. That's a different
way to split off parts of the generated code, motivated by the
desire to use poisoned identifiers such as TARGET_I386. I noted in
my review of v3 that I "can either accept it, or come up with a
better solution." This is my attempt at a better solution. It's a
bit more ambitious, and thus more useful (I hope). The pragma has
one theoretical advantage, though: you can modularize the generated
output in different ways than the input. The patches using don't do
that, however.
I'm going to post RFC patches that show how to do a target-dependent
module. Then we can discuss the two approaches.