Received: from eggs.gnu.org ([2001:4830:134:3::10]:34217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9U0f-0000ZX-Fm for qemu-devel@nongnu.org; Thu, 17 Dec 2015 03:34:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9U0e-0001Dz-6T for qemu-devel@nongnu.org; Thu, 17 Dec 2015 03:34:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9U0e-0001Dt-02 for qemu-devel@nongnu.org; Thu, 17 Dec 2015 03:34:00 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id A642872 for ; Thu, 17 Dec 2015 08:33:59 +0000 (UTC) From: Markus Armbruster Date: Thu, 17 Dec 2015 09:33:36 +0100 Message-Id: <1450341225-2735-32-git-send-email-armbru@redhat.com> In-Reply-To: <1450341225-2735-1-git-send-email-armbru@redhat.com> References: <1450341225-2735-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PULL 31/40] qapi-types: Drop unnedeed ._fwdefn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Eric Blake 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 Signed-off-by: Eric Blake Message-Id: <1449033659-25497-6-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster --- 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