This series introduces alias definitions for QAPI object types (structs and unions).
This allows using the same QAPI type and visitor even when the syntax has some variations between different external interfaces such as QMP and the command line. It also provides a new tool for evolving the schema while maintaining backwards compatibility (possibly during a deprecation period). The first user is intended to be a QAPIfied -chardev command line option, for which I'll send a separate series. A git tag is available that contains both this series and the chardev changes that make use of it: https://repo.or.cz/qemu/kevin.git qapi-alias-chardev-v2 v2: - Renamed 'alias' to 'name' in all data structures describing aliases - Tons of new or changed comments and other documentation - Be more explicit that empty 'source' is invalid and assert it - Fixed full_name_so() for lists (added a parameter to tell the function whether the name of a list member or the list itself is meant) - Changed some QAPI generator error messages - Assert the type of parameters in QAPISchemaAlias.__init__() Kevin Wolf (6): qapi: Add interfaces for alias support to Visitor qapi: Remember alias definitions in qobject-input-visitor qapi: Simplify full_name_nth() in qobject-input-visitor qapi: Apply aliases in qobject-input-visitor qapi: Add support for aliases tests/qapi-schema: Test cases for aliases docs/devel/qapi-code-gen.txt | 105 ++++- docs/sphinx/qapidoc.py | 2 +- include/qapi/visitor-impl.h | 12 + include/qapi/visitor.h | 44 ++ qapi/qapi-visit-core.c | 22 + qapi/qobject-input-visitor.c | 402 ++++++++++++++++-- scripts/qapi/expr.py | 36 +- scripts/qapi/schema.py | 30 +- scripts/qapi/types.py | 4 +- scripts/qapi/visit.py | 34 +- tests/qapi-schema/test-qapi.py | 7 +- tests/qapi-schema/alias-bad-type.err | 2 + tests/qapi-schema/alias-bad-type.json | 3 + tests/qapi-schema/alias-bad-type.out | 0 tests/qapi-schema/alias-missing-source.err | 2 + tests/qapi-schema/alias-missing-source.json | 3 + tests/qapi-schema/alias-missing-source.out | 0 tests/qapi-schema/alias-name-bad-type.err | 2 + tests/qapi-schema/alias-name-bad-type.json | 3 + tests/qapi-schema/alias-name-bad-type.out | 0 tests/qapi-schema/alias-source-bad-type.err | 2 + tests/qapi-schema/alias-source-bad-type.json | 3 + tests/qapi-schema/alias-source-bad-type.out | 0 .../alias-source-elem-bad-type.err | 2 + .../alias-source-elem-bad-type.json | 3 + .../alias-source-elem-bad-type.out | 0 tests/qapi-schema/alias-source-empty.err | 2 + tests/qapi-schema/alias-source-empty.json | 3 + tests/qapi-schema/alias-source-empty.out | 0 tests/qapi-schema/alias-unknown-key.err | 3 + tests/qapi-schema/alias-unknown-key.json | 3 + tests/qapi-schema/alias-unknown-key.out | 0 tests/qapi-schema/aliases-bad-type.err | 2 + tests/qapi-schema/aliases-bad-type.json | 3 + tests/qapi-schema/aliases-bad-type.out | 0 tests/qapi-schema/double-type.err | 2 +- tests/qapi-schema/meson.build | 8 + tests/qapi-schema/qapi-schema-test.json | 24 ++ tests/qapi-schema/qapi-schema-test.out | 29 ++ tests/qapi-schema/unknown-expr-key.err | 2 +- 40 files changed, 757 insertions(+), 47 deletions(-) create mode 100644 tests/qapi-schema/alias-bad-type.err create mode 100644 tests/qapi-schema/alias-bad-type.json create mode 100644 tests/qapi-schema/alias-bad-type.out create mode 100644 tests/qapi-schema/alias-missing-source.err create mode 100644 tests/qapi-schema/alias-missing-source.json create mode 100644 tests/qapi-schema/alias-missing-source.out create mode 100644 tests/qapi-schema/alias-name-bad-type.err create mode 100644 tests/qapi-schema/alias-name-bad-type.json create mode 100644 tests/qapi-schema/alias-name-bad-type.out create mode 100644 tests/qapi-schema/alias-source-bad-type.err create mode 100644 tests/qapi-schema/alias-source-bad-type.json create mode 100644 tests/qapi-schema/alias-source-bad-type.out create mode 100644 tests/qapi-schema/alias-source-elem-bad-type.err create mode 100644 tests/qapi-schema/alias-source-elem-bad-type.json create mode 100644 tests/qapi-schema/alias-source-elem-bad-type.out create mode 100644 tests/qapi-schema/alias-source-empty.err create mode 100644 tests/qapi-schema/alias-source-empty.json create mode 100644 tests/qapi-schema/alias-source-empty.out create mode 100644 tests/qapi-schema/alias-unknown-key.err create mode 100644 tests/qapi-schema/alias-unknown-key.json create mode 100644 tests/qapi-schema/alias-unknown-key.out create mode 100644 tests/qapi-schema/aliases-bad-type.err create mode 100644 tests/qapi-schema/aliases-bad-type.json create mode 100644 tests/qapi-schema/aliases-bad-type.out -- 2.29.2