From 3e7fb5811baab213dcc7149c3aa69442d683c26c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 20 Nov 2019 19:25:50 +0100 Subject: 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 Message-Id: <20191120182551.23795-6-armbru@redhat.com> Reviewed-by: Eric Blake --- tests/qapi-schema/include-repetition.out | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/qapi-schema/include-repetition.out') diff --git a/tests/qapi-schema/include-repetition.out b/tests/qapi-schema/include-repetition.out index 5423983239..0b654ddebb 100644 --- a/tests/qapi-schema/include-repetition.out +++ b/tests/qapi-schema/include-repetition.out @@ -11,15 +11,13 @@ enum QType member qbool module include-repetition.json include comments.json +include include-repetition-sub.json +include comments.json module comments.json enum Status member good member bad member ugly -module include-repetition.json -include include-repetition-sub.json module include-repetition-sub.json include comments.json include comments.json -module include-repetition.json -include comments.json -- cgit v1.2.3