qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 04/46] qapi: Add tests for empty unions


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v5 04/46] qapi: Add tests for empty unions
Date: Thu, 24 Sep 2015 09:52:08 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 09/24/2015 08:16 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> The documentation claims that alternates are useful for
>> allowing two types, although nothing enforces this.  Meanwhile,
>> it is silent on whether empty unions are allowed.  In practice,
>> the generated code will compile, in part because we have a
>> 'void *data' branch; but attempting to visit such a type will
>> cause an abort().  Add some tests to expose the problems, and
> 
> There's nothing really wrong with degenerate alternates or unions, but I
> don't want to spend time on making them work.  Outlawing them will do.
> The commit message could perhaps be rephrased a bit to better convey
> that.

Sure, that sounds like a better wording to weave in.

> 
> What about empty structs and enums?

Empty structs: required support (for example, 'Abort' as a member of
'transaction's union).

Empty enums: Documented as not very useful but currently supported, and
we already have code that tests that we don't choke on them.

> 
>> adjust existing tests that should be failing for other reasons.
> 
> I had to read this a few times until I understood "should be failing for
> other reasons" means something like "are meant to test something else,
> but could fail for the wrong reason if we reject degenerate alternates /
> unions".

I like it.

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

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