[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V7 02/11] qapi script: add check for duplicated
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH V7 02/11] qapi script: add check for duplicated key |
Date: |
Thu, 20 Feb 2014 13:05:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Wenchao Xia <address@hidden> writes:
> It is bad that same key was specified twice, especially when a union have
> two branches with same condition. This patch can prevent it.
>
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
> scripts/qapi.py | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index bd81f06..3732fe1 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -116,6 +116,8 @@ class QAPISchema:
> if self.tok != ':':
> raise QAPISchemaError(self, 'Expected ":"')
> self.accept()
> + if key in expr:
> + raise QAPISchemaError(self, 'Duplicate key "%s"' % key)
> expr[key] = self.get_expr(True)
> if self.tok == '}':
> self.accept()
The test for this error is in 11/11. If you need to respin anyway,
consider adding error tests in the same patch as the error they test.
- [Qemu-devel] [PATCH V7 00/11] qapi script: support enum as discriminator and better enum name, Wenchao Xia, 2014/02/20
- [Qemu-devel] [PATCH V7 02/11] qapi script: add check for duplicated key, Wenchao Xia, 2014/02/20
- Re: [Qemu-devel] [PATCH V7 02/11] qapi script: add check for duplicated key,
Markus Armbruster <=
- [Qemu-devel] [PATCH V7 06/11] qapi script: use same function to generate enum string, Wenchao Xia, 2014/02/20
- [Qemu-devel] [PATCH V7 05/11] qapi script: code move for generate_enum_name(), Wenchao Xia, 2014/02/20
- [Qemu-devel] [PATCH V7 03/11] qapi-script: remember line number in schema parsing, Wenchao Xia, 2014/02/20
[Qemu-devel] [PATCH V7 04/11] qapi script: check correctness of discriminator values in union, Wenchao Xia, 2014/02/20