unicorn/qemu/scripts
Eric Blake b513481b9a
qapi: Emit structs used as variants in topological order
Right now, we emit the branches of union types as a boxed pointer,
and it suffices to have a forward declaration of the type. However,
a future patch will swap things to directly use the branch type,
instead of hiding it behind a pointer. For this to work, the
compiler needs the full definition of the type, not just a forward
declaration, prior to the union that is including the branch type.
This patch just adds topological sorting to hoist all types
mentioned in a branch of a union to be fully declared before the
union itself. The sort is always possible, because we do not
allow circular union types that include themselves as a direct
branch (it is, however, still possible to include a branch type
that itself has a pointer to the union, for a type that can
indirectly recursively nest itself - that remains safe, because
that the member of the branch type will remain a pointer, and the
QMP representation of such a type adds another {} for each recurring
layer of the union type).

Backports commit 1de5d4ca0752138034305f3d4e8fe17ef6503569 from qemu
2018-02-20 16:02:29 -05:00
..
create_config
make_device_config.sh
ordereddict.py
qapi-event.py qapi: Drop unused 'kind' for struct/enum visit 2018-02-19 23:43:54 -05:00
qapi-types.py qapi: Emit structs used as variants in topological order 2018-02-20 16:02:29 -05:00
qapi-visit.py qapi-visit: Less indirection in visit_type_Foo_fields() 2018-02-20 16:00:37 -05:00
qapi.py qapi: Forbid 'any' inside an alternate 2018-02-20 15:47:16 -05:00