[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v11 10/15] qapi: Emit structs used as variants i
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v11 10/15] qapi: Emit structs used as variants in topological order |
Date: |
Thu, 18 Feb 2016 15:35:23 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> Right now, we emit the branches of union types as a boxed pointer,
> and it suffices to have a forward declaration of the type. However,
> a future patch will swap things to directly use the branch type,
> instead of hiding it behind a pointer. For this to work, the
> compiler needs the full definition of the type, not just a forward
> declaration, prior to the union that is including the branch type.
> This patch just adds topological sorting to hoist all types
> mentioned in a branch of a union to be fully declared before the
> union itself. The sort is always possible, because we do not
> allow circular union types that include themselves as a direct
> branch
When a patch makes a "can't happen" claim, I normally ask for assertions
to make sure we go down in flames should it happen anyway. But in this
case, the C compiler will shoot us down then, and that'll do nicely.
> (it is, however, still possible to include a branch type
> that itself has a pointer to the union, for a type that can
> indirectly recursively nest itself - that remains safe, because
> that the member of the branch type will remain a pointer, and the
> QMP representation of such a type adds another {} for each recurring
> layer of the union type).
>
> Signed-off-by: Eric Blake <address@hidden>
[Qemu-devel] [PATCH v11 10/15] qapi: Emit structs used as variants in topological order, Eric Blake, 2016/02/18
- Re: [Qemu-devel] [PATCH v11 10/15] qapi: Emit structs used as variants in topological order,
Markus Armbruster <=
[Qemu-devel] [PATCH v11 09/15] qapi: Adjust layout of FooList types, Eric Blake, 2016/02/18
[Qemu-devel] [PATCH v11 14/15] qapi: Delete visit_start_union(), gen_visit_implicit_struct(), Eric Blake, 2016/02/18
[Qemu-devel] [PATCH v11 08/15] qapi-visit: Less indirection in visit_type_Foo_fields(), Eric Blake, 2016/02/18
[Qemu-devel] [PATCH v11 11/15] qapi-visit: Use common idiom in gen_visit_fields_decl(), Eric Blake, 2016/02/18
[Qemu-devel] [PATCH v11 12/15] qapi: Don't box struct branch of alternate, Eric Blake, 2016/02/18