On 12/23/2014 08:50 AM, Peter Maydell wrote: > In qapi-schema.json we have a couple of entries that define > empty structures, like this: > > { 'type': 'ChardevDummy', 'data': { } } > > In the generated qapi-types.h these are turned into empty C structs: > > Although you could argue that we don't care about differences > in C and C++ semantics, having a zero-sized struct floating > around seems a bit risky to me, since for instance a naive > attempt to g_malloc() space for it will return NULL. Oh, good point. > > How should we handle these? Should the qapi-types generator > stick a dummy field in so they aren't zero sized? Sounds like the best plan to me. > Are they > actually an error in the schema? (what's the point of them?) No, they are valid - it is how you express a union between a branch that needs no additional members compared to any other branch. > Do we claim that actually all our code correctly handles > zero sized structs and just suppress the clang warning? I'd be fine with adding a dummy member. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org