From dcac64711ea906e844ae60a5927e5580f7252c1e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 14 Feb 2019 16:22:36 +0100 Subject: qapi: Clean up modular built-in code generation a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We neglect to call .visit_module() for the special module we use for built-ins. Harmless, but clean it up anyway. The tests/qapi-schema/*.out now show the built-in module as 'module None'. Subclasses of QAPISchemaModularCVisitor need to ._add_module() this special module to enable code generation for built-ins. When this hasn't been done, QAPISchemaModularCVisitor.visit_module() does nothing for the special module. That looks like built-ins could accidentally be generated into the wrong module when a subclass neglects to call ._add_module(). Can't happen, because built-ins are all visited before any other module. But that's non-obvious. Switch off code generation explicitly. Rename QAPISchemaModularCVisitor._begin_module() to ._begin_user_module(). New QAPISchemaModularCVisitor._is_builtin_module(), for clarity. Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau Message-Id: <20190214152251.2073-4-armbru@redhat.com> --- tests/qapi-schema/comments.out | 1 + tests/qapi-schema/doc-bad-section.out | 1 + tests/qapi-schema/doc-good.out | 1 + tests/qapi-schema/empty.out | 1 + tests/qapi-schema/event-case.out | 1 + tests/qapi-schema/ident-with-escape.out | 1 + tests/qapi-schema/include-relpath.out | 1 + tests/qapi-schema/include-repetition.out | 1 + tests/qapi-schema/include-simple.out | 1 + tests/qapi-schema/indented-expr.out | 1 + tests/qapi-schema/qapi-schema-test.out | 1 + 11 files changed, 11 insertions(+) (limited to 'tests/qapi-schema') diff --git a/tests/qapi-schema/comments.out b/tests/qapi-schema/comments.out index d1abc4b..273f0f5 100644 --- a/tests/qapi-schema/comments.out +++ b/tests/qapi-schema/comments.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/doc-bad-section.out b/tests/qapi-schema/doc-bad-section.out index db8014e..367e2a1 100644 --- a/tests/qapi-schema/doc-bad-section.out +++ b/tests/qapi-schema/doc-bad-section.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 21bf345..d3bca34 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/empty.out b/tests/qapi-schema/empty.out index 5483cb7..5b53d00 100644 --- a/tests/qapi-schema/empty.out +++ b/tests/qapi-schema/empty.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/event-case.out b/tests/qapi-schema/event-case.out index f69d4ff..ec8a140 100644 --- a/tests/qapi-schema/event-case.out +++ b/tests/qapi-schema/event-case.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/ident-with-escape.out b/tests/qapi-schema/ident-with-escape.out index 7f891f7..39754eb 100644 --- a/tests/qapi-schema/ident-with-escape.out +++ b/tests/qapi-schema/ident-with-escape.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/include-relpath.out b/tests/qapi-schema/include-relpath.out index 783ccfc..cf8636b 100644 --- a/tests/qapi-schema/include-relpath.out +++ b/tests/qapi-schema/include-relpath.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/include-repetition.out b/tests/qapi-schema/include-repetition.out index d45977e..5423983 100644 --- a/tests/qapi-schema/include-repetition.out +++ b/tests/qapi-schema/include-repetition.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/include-simple.out b/tests/qapi-schema/include-simple.out index 1afe208..061f81e 100644 --- a/tests/qapi-schema/include-simple.out +++ b/tests/qapi-schema/include-simple.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/indented-expr.out b/tests/qapi-schema/indented-expr.out index c0cf324..bffdf67 100644 --- a/tests/qapi-schema/indented-expr.out +++ b/tests/qapi-schema/indented-expr.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index 9464101..d8aec17 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -1,3 +1,4 @@ +module None object q_empty enum QType prefix QTYPE -- cgit v1.1