summaryrefslogtreecommitdiffstats
path: root/scripts/qapi-types.py
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-12-01 22:20:49 -0700
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:19 -0600
commit57db6482291c7eade3cead7835742669292eff4c (patch)
tree03f9a2e65401275fe6228235b6dd780911119a7d /scripts/qapi-types.py
parentc2ee6c7c2da2aef4240a32b63ff017baaf2317e5 (diff)
downloadhqemu-57db6482291c7eade3cead7835742669292eff4c.zip
hqemu-57db6482291c7eade3cead7835742669292eff4c.tar.gz
qapi-types: Drop unnedeed ._fwdefn
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 <armbru@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1449033659-25497-6-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi-types.py')
-rw-r--r--scripts/qapi-types.py6
1 files changed, 1 insertions, 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):
OpenPOWER on IntegriCloud