qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC 14/21] qapi: Generate in source order


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH RFC 14/21] qapi: Generate in source order
Date: Tue, 06 Feb 2018 11:33:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Markus Armbruster <address@hidden> writes:

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]