[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v14 05/15] qapi-types: Drop unnedeed ._fwdefn
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v14 05/15] qapi-types: Drop unnedeed ._fwdefn |
Date: |
Tue, 1 Dec 2015 22:20:49 -0700 |
Previously, the generated code in qapi-types.c initialized all
enum lookup tables first, prior to any other definitions. But
there are no topological sorting requirements that mandate this
layout, so we can drop the QAPISchemaGenTypeVisitor._fwdefn
field and just generate all definitions in visitation order.
The generated code shows some churn due to reordering, but it
is still fairly straightforward to follow (all the deletions
occur in one hunk, and all the deleted lines are re-inserted
in the same order later in the same files, just spread across
multiple insertion points).
Suggested-by: Markus Armbruster <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
v14: new patch
---
scripts/qapi-types.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 84ec858..0d86269 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -168,21 +168,17 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):
self.decl = None
self.defn = None
self._fwdecl = None
- self._fwdefn = None
self._btin = None
def visit_begin(self, schema):
self.decl = ''
self.defn = ''
self._fwdecl = ''
- self._fwdefn = ''
self._btin = guardstart('QAPI_TYPES_BUILTIN')
def visit_end(self):
self.decl = self._fwdecl + self.decl
self._fwdecl = None
- self.defn = self._fwdefn + self.defn
- self._fwdefn = None
# To avoid header dependency hell, we always generate
# declarations for built-in types in our header files and
# simply guard them. See also do_builtins (command line
@@ -209,7 +205,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):
self.defn += gen_enum_lookup(name, values, prefix)
else:
self._fwdecl += gen_enum(name, values, prefix)
- self._fwdefn += gen_enum_lookup(name, values, prefix)
+ self.defn += gen_enum_lookup(name, values, prefix)
def visit_array_type(self, name, info, element_type):
if isinstance(element_type, QAPISchemaBuiltinType):
--
2.4.3
- [Qemu-devel] [PATCH v14 00/15] qapi member collision (post-introspection cleanups, subset D), Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 05/15] qapi-types: Drop unnedeed ._fwdefn,
Eric Blake <=
- [Qemu-devel] [PATCH v14 06/15] qapi: Inline _make_implicit_tag(), Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 01/15] qobject: Simplify QObject, Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 07/15] qapi: Fix alternates that accept 'number' but not 'int', Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 09/15] qapi: Shorter visits of optional fields, Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 02/15] qobject: Rename qtype_code to QType, Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 10/15] qapi: Prepare new QAPISchemaMember base class, Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 03/15] qapi: Convert QType into QAPI built-in enum type, Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 08/15] qapi: Simplify visits of optional fields, Eric Blake, 2015/12/02
- [Qemu-devel] [PATCH v14 11/15] qapi: Track enum values by QAPISchemaMember, not string, Eric Blake, 2015/12/02