On 06/20/2014 05:47 PM, Wenchao Xia wrote:

>> Not your fault, as the problem already exists, but it's a bit awkward
>> that qapi-event.json is not self-contained, and your patch is only
>> making it worse.  qapi-event.json only makes sense when included by
>> qapi-schema.json, when ideally it would be nice if it made sense if
>> compiled in isolation. I already pointed this fact out on Wenchao's
>> series that made events part of QAPI, but fixing it first requires
>> teaching the code generators to flag places where a type is used without
>> a pre-definition, so that we know which types have to be moved into a
>> common include.  So don't let this comment hold up your patch.
>>
>   I think two issues should be addressed:
> 1 don't let generator guess the type if define is not found.

But we WANT to allow use of a type so long as it gets defined later in
the same file.  So the trick is distinguishing between:

base.json - use of 'TypeFoo'
total.json: include base.json, define 'TypeFoo'

(broken, base.json was not self-contained)

vs.

base.json - define 'TypeFoo'
total.json - use of 'TypeFoo', then include base.json

(supported - even though 'TypeFoo' was used prior to being defined, the
include later in the file meant that total.json was self-contained)

> 2 Support duplicated include, that is:
> 
>              qapi/types.json
>                      |
>       ---------------------------
>       |                          |
> qapi/qapi-event.json      qapi/block.json
>              |                |
>               qapi-schema-json
> 
>   Making sure above include doesn't generate two copy of types from
> qapi/types.json.

We already support that.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to