[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 16/28] qapi: Better error messages for duplic
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 16/28] qapi: Better error messages for duplicated expressions |
Date: |
Fri, 27 Mar 2015 13:53:55 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 03/27/2015 01:52 AM, Markus Armbruster wrote:
> One more...
>
> Eric Blake <address@hidden> writes:
>
> [...]
>> diff --git a/scripts/qapi.py b/scripts/qapi.py
>> index 90eb3bc..5d0dc91 100644
>> --- a/scripts/qapi.py
>> +++ b/scripts/qapi.py
> [...]
>> @@ -560,12 +585,22 @@ def type_name(name):
>> return c_list_type(name[0])
>> return name
>>
>> -enum_types = []
>> -struct_types = []
>> -union_types = []
>> +def add_name(name, info, meta, implicit = False):
>> + global all_names
>> + if name in all_names:
>> + raise QAPIExprError(info,
>> + "%s '%s' is already defined"
>> + %(all_names[name], name))
>
> We say "struct 'Foo'", and expect the user to know that 'struct' means
> 'complex type'. It'll do, it's just a development tool.
In fact, I considered making it "type 'Foo'", to match that the item is
declared with { 'type':'Foo' ...} and not { 'struct':'Foo' ...}. But
type is an ambiguous word. I'm half tempted to do a global
search-and-replace of s/'type'/'struct'/ in the json files, since
'union' is also a type. Obviously as its own patch.
>
> I'm not really happy with 'complex type', though. Isn't a union type
> complex, too? Anyway, we can clean up our confused terminology later;
> this series is long enough.
Hmm. If I _do_ the global rename, then we have a nice hierarchy:
type - simple type: built-in, enum
- alternate
- complex type: struct, union
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v5 22/28] qapi: Whitelist commands that don't return dictionary, (continued)
[Qemu-devel] [PATCH v5 23/28] qapi: More rigorous checking for type safety bypass, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 19/28] qapi: Add some type check tests, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 16/28] qapi: Better error messages for duplicated expressions, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 20/28] qapi: More rigourous checking of types, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 21/28] qapi: Require valid names, Eric Blake, 2015/03/24
Re: [Qemu-devel] [PATCH v5 21/28] qapi: Require valid names, Markus Armbruster, 2015/03/27