qemu-devel
[Top][All Lists]
Advanced

[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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v5 16/28] qapi: Better error messages for duplicated expressions
Date: Sun, 29 Mar 2015 10:38:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Eric Blake <address@hidden> writes:

> 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.

No objections.  The churn will be a bit annoying with git-blame, but I'd
prefer that to continuing with confusing terminology.

>> 
>> 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

Indeed.

The odd in-between-ness of alternate here is additional justification
for you separating it from union.



reply via email to

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