Markus Armbruster <arm...@redhat.com> writes: > Marc-Andre Lureau <mlur...@redhat.com> writes: > >> On Fri, Feb 2, 2018 at 2:03 PM, Markus Armbruster <arm...@redhat.com> 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 <arm...@redhat.com> >>> --- >>> 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.