From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej0ZW-00076G-GL for qemu-devel@nongnu.org; Tue, 06 Feb 2018 05:33:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej0ZT-0006b7-Ck for qemu-devel@nongnu.org; Tue, 06 Feb 2018 05:33:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53646) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej0ZT-0006Y4-5A for qemu-devel@nongnu.org; Tue, 06 Feb 2018 05:33:51 -0500 From: Markus Armbruster References: <20180202130336.24719-1-armbru@redhat.com> <20180202130336.24719-15-armbru@redhat.com> <87mv0nv73y.fsf@dusky.pond.sub.org> Date: Tue, 06 Feb 2018 11:33:45 +0100 In-Reply-To: <87mv0nv73y.fsf@dusky.pond.sub.org> (Markus Armbruster's message of "Mon, 05 Feb 2018 15:33:37 +0100") Message-ID: <87h8qucsqe.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH RFC 14/21] qapi: Generate in source order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marc-Andre Lureau Cc: marcandre , qemu-devel , mdroth@linux.vnet.ibm.com Markus Armbruster writes: > Marc-Andre Lureau writes: > >> On Fri, Feb 2, 2018 at 2:03 PM, Markus Armbruster wrote: >>> The generators' conversion to visitors (merge commit 9e72681d16) >>> changed the processing order of entities from source order to >>> alphabetical order. The next commit needs source order, so change it >>> back. >>> >>> Signed-off-by: Markus Armbruster >>> --- >>> scripts/qapi/common.py | 4 +- >>> tests/qapi-schema/comments.out | 2 +- >>> tests/qapi-schema/doc-bad-section.out | 4 +- >>> tests/qapi-schema/doc-good.out | 32 ++-- >>> tests/qapi-schema/empty.out | 2 +- >>> tests/qapi-schema/event-case.out | 2 +- >>> tests/qapi-schema/ident-with-escape.out | 6 +- >>> tests/qapi-schema/include-relpath.out | 2 +- >>> tests/qapi-schema/include-repetition.out | 2 +- >>> tests/qapi-schema/include-simple.out | 2 +- >>> tests/qapi-schema/indented-expr.out | 2 +- >>> tests/qapi-schema/qapi-schema-test.out | 320 +++++++++++++++---------------- >>> 12 files changed, 191 insertions(+), 189 deletions(-) >>> >>> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py >>> index d5b93e7381..3b97bf8702 100644 >>> --- a/scripts/qapi/common.py >>> +++ b/scripts/qapi/common.py >>> @@ -1471,6 +1471,7 @@ class QAPISchema(object): >>> parser = QAPISchemaParser(open(fname, 'r')) >>> exprs = check_exprs(parser.exprs) >>> self.docs = parser.docs >>> + self._entity_list = [] >>> self._entity_dict = {} >>> self._predefining = True >>> self._def_predefineds() >>> @@ -1482,6 +1483,7 @@ class QAPISchema(object): >>> # Only the predefined types are allowed to not have info >>> assert ent.info or self._predefining >>> assert ent.name not in self._entity_dict >>> + self._entity_list.append(ent) >>> self._entity_dict[ent.name] = ent >> >> Why not use the OrderedDict instead? > > Fair question! However, the next patch will create anonymous entities, > which get added only to ._entity_list, not _entity_dict. > > [...] Flaw in QAPISchema.check(): for ent in self._entity_dict.values(): ent.check(self) Need to iterate over entity_list, or else we fail to check anonymous entities. Currently harmless, as QAPISchemaInclude.check() does nothing. I'll fix it.