[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v3 05/32] scripts/qapi: add QAPISchemaVisitor.visit_module_end
From: |
Markus Armbruster |
Subject: |
Re: [RFC v3 05/32] scripts/qapi: add QAPISchemaVisitor.visit_module_end |
Date: |
Wed, 08 Sep 2021 14:26:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
marcandre.lureau@redhat.com writes:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Used in following patches to generate code after visiting a module.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> scripts/qapi/schema.py | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
> index 1f6301c394..6455a8f425 100644
> --- a/scripts/qapi/schema.py
> +++ b/scripts/qapi/schema.py
> @@ -128,6 +128,9 @@ def visit_end(self):
> def visit_module(self, name):
> pass
>
> + def visit_module_end(self, name) -> None:
> + pass
> +
> def visit_needed(self, entity):
> # Default to visiting everything
> return True
> @@ -207,6 +210,7 @@ def visit(self, visitor):
> for entity in self._entity_list:
> if visitor.visit_needed(entity):
> entity.visit(visitor)
> + visitor.visit_module_end(self.name)
>
>
> class QAPISchemaInclude(QAPISchemaEntity):
QAPISchema.visit(vis) now calls:
vis.visit_begin
for each module:
vis.visit_module(module.name)
for each entity in module
entity.visit(vis)
vis.visit_module_end(module.name)
vis.visit_end
The .visit_module_end() isn't strictly necessary (we could do its work
in .visit_module() and .visit_end()). But it's probably simpler this
way.
Let's rename .visit_module() to .visit_module_begin(), for symmetry with
.visit_begin(), .visit_end().
- [RFC v3 02/32] build-sys: add HAVE_IPPROTO_MPTCP, (continued)
- [RFC v3 02/32] build-sys: add HAVE_IPPROTO_MPTCP, marcandre . lureau, 2021/09/07
- [RFC v3 03/32] scripts/qapi: teach c_param_type() to return const argument type, marcandre . lureau, 2021/09/07
- [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER, marcandre . lureau, 2021/09/07
- [RFC v3 05/32] scripts/qapi: add QAPISchemaVisitor.visit_module_end, marcandre . lureau, 2021/09/07
- Re: [RFC v3 05/32] scripts/qapi: add QAPISchemaVisitor.visit_module_end,
Markus Armbruster <=
- [RFC v3 06/32] scripts/qapi: add a CABI module, marcandre . lureau, 2021/09/07
- [RFC v3 07/32] scripts/qapi: generate CABI dump for C types, marcandre . lureau, 2021/09/07
- [RFC v3 08/32] tests: build qapi-cabi (C ABI dump), marcandre . lureau, 2021/09/07
- [RFC v3 09/32] build-sys: add i686 cpu target, marcandre . lureau, 2021/09/07
- [RFC v3 10/32] build-sys: add --with-rust{-target} & basic build infrastructure, marcandre . lureau, 2021/09/07
- [RFC v3 11/32] build-sys: add a cargo-wrapper script, marcandre . lureau, 2021/09/07
- [RFC v3 12/32] rust: provide a common crate for QEMU, marcandre . lureau, 2021/09/07