mbox series

[v2,0/9] qapi: untie 'if' conditions from C preprocessor

Message ID 20201105122808.1182973-1-marcandre.lureau@redhat.com
Headers show
Series qapi: untie 'if' conditions from C preprocessor | expand

Message

Marc-André Lureau Nov. 5, 2020, 12:27 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>


Hi,

This series makes the 'if' conditions less liberal, by formalizing a simple
expression tree based on bare boolean logic of configure option identifiers.

(this will allow to express conditions in Rust in my QAPI-Rust PoC series, but
it is worth a standalone post)

This is based on John Snow QAPI cleanup branch:
https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt6

thanks

v2:
 - fix the normalization step to handle recursive expr
 - replace IfCond by QAPISchemaIf (JohnS)
 - commit message and documentation tweaks
 - mypy/flake8/isort

Marc-André Lureau (9):
  qapi: replace List[str] by QAPISchemaIf
  qapi: move gen_if/gen_endif to QAPIIfSchema
  qapi: start building an 'if' predicate tree
  qapi: introduce IfPredicateList and IfAny
  qapi: add IfNot
  qapi: normalize 'if' condition to IfPredicate tree
  qapi: convert 'if' C expressions to the new literal form
  qapi: make 'if' condition strings simple identifiers
  docs: update the documentation about schema configuration

 docs/devel/qapi-code-gen.txt                  |  32 ++--
 docs/sphinx/qapidoc.py                        |   6 +-
 qapi/block-core.json                          |  16 +-
 qapi/char.json                                |   8 +-
 qapi/machine-target.json                      |  28 +++-
 qapi/migration.json                           |  10 +-
 qapi/misc-target.json                         |  35 +++--
 qapi/ui.json                                  |  48 +++---
 scripts/qapi/commands.py                      |   3 +-
 scripts/qapi/common.py                        |  85 +++++++++--
 scripts/qapi/events.py                        |   3 +-
 scripts/qapi/expr.py                          |  64 +++++---
 scripts/qapi/gen.py                           |  21 +--
 scripts/qapi/introspect.py                    |  36 +++--
 scripts/qapi/schema.py                        | 138 ++++++++++++------
 scripts/qapi/types.py                         |  39 +++--
 scripts/qapi/visit.py                         |  23 ++-
 .../alternate-branch-if-invalid.err           |   2 +-
 tests/qapi-schema/bad-if-empty.err            |   2 +-
 tests/qapi-schema/bad-if-list.err             |   2 +-
 tests/qapi-schema/bad-if.err                  |   3 +-
 tests/qapi-schema/bad-if.json                 |   2 +-
 tests/qapi-schema/doc-good.json               |   6 +-
 tests/qapi-schema/doc-good.out                |  12 +-
 tests/qapi-schema/enum-if-invalid.err         |   3 +-
 tests/qapi-schema/features-if-invalid.err     |   2 +-
 tests/qapi-schema/features-missing-name.json  |   2 +-
 tests/qapi-schema/qapi-schema-test.json       |  55 +++----
 tests/qapi-schema/qapi-schema-test.out        |  63 ++++----
 .../qapi-schema/struct-member-if-invalid.err  |   2 +-
 tests/qapi-schema/union-branch-if-invalid.err |   2 +-
 tests/test-qmp-cmds.c                         |   1 +
 32 files changed, 456 insertions(+), 298 deletions(-)

-- 
2.29.0