]> Git Repo - qemu.git/commit
qapi: Fix code generation for empty modules
authorMarkus Armbruster <[email protected]>
Wed, 20 Nov 2019 18:25:50 +0000 (19:25 +0100)
committerMarkus Armbruster <[email protected]>
Tue, 14 Jan 2020 10:01:58 +0000 (11:01 +0100)
commit3e7fb5811baab213dcc7149c3aa69442d683c26c
tree4488c46b75ebf4f4746602217b51f29fc6fb5527
parenta9f1dd7ee001b645b81ad67217b582e51a44d545
qapi: Fix code generation for empty modules

When a sub-module doesn't contain any definitions, we don't generate
code for it, but we do generate the #include.

We generate code only for modules that get visited.
QAPISchema.visit() visits only modules that have definitions.  It can
visit modules multiple times.

Clean this up as follows.  Collect entities in their QAPISchemaModule.
Have QAPISchema.visit() call QAPISchemaModule.visit() for each module.
Have QAPISchemaModule.visit() call .visit_module() for itself, and
QAPISchemaEntity.visit() for each of its entities.  This way, we visit
each module exactly once.

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20191120182551[email protected]>
Reviewed-by: Eric Blake <[email protected]>
scripts/qapi/schema.py
tests/qapi-schema/empty.out
tests/qapi-schema/include-repetition.out
tests/qapi-schema/qapi-schema-test.out
This page took 0.027011 seconds and 4 git commands to generate.