[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 0/9] qapi: untie 'if' conditions from C preprocessor
From: |
marcandre . lureau |
Subject: |
[PATCH v2 0/9] qapi: untie 'if' conditions from C preprocessor |
Date: |
Thu, 5 Nov 2020 16:27:59 +0400 |
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
- [PATCH v2 0/9] qapi: untie 'if' conditions from C preprocessor,
marcandre . lureau <=
- [PATCH v2 1/9] qapi: replace List[str] by QAPISchemaIf, marcandre . lureau, 2020/11/05
- [PATCH v2 2/9] qapi: move gen_if/gen_endif to QAPIIfSchema, marcandre . lureau, 2020/11/05
- [PATCH v2 3/9] qapi: start building an 'if' predicate tree, marcandre . lureau, 2020/11/05
- [PATCH v2 4/9] qapi: introduce IfPredicateList and IfAny, marcandre . lureau, 2020/11/05
- [PATCH v2 5/9] qapi: add IfNot, marcandre . lureau, 2020/11/05
- [PATCH v2 6/9] qapi: normalize 'if' condition to IfPredicate tree, marcandre . lureau, 2020/11/05
- [PATCH v2 7/9] qapi: convert 'if' C expressions to the new literal form, marcandre . lureau, 2020/11/05
- [PATCH v2 8/9] qapi: make 'if' condition strings simple identifiers, marcandre . lureau, 2020/11/05
- [PATCH v2 9/9] docs: update the documentation about schema configuration, marcandre . lureau, 2020/11/05