[Top][All Lists]

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

Re: [PATCH 3/6] qapi: Remove wrapper struct for simple unions

From: Marc-André Lureau
Subject: Re: [PATCH 3/6] qapi: Remove wrapper struct for simple unions
Date: Fri, 23 Oct 2020 15:06:46 +0400


On Fri, Oct 23, 2020 at 2:40 PM Marc-André Lureau <marcandre.lureau@gmail.com> wrote:

On Fri, Oct 23, 2020 at 2:14 PM Kevin Wolf <kwolf@redhat.com> wrote:
Variants of simple unions are always contained in a wrapper object
called 'data' that serves no real use. When mapping a QAPI object to the
command line, this becomes very visible to users because they have to
add one or more useless 'data.' to many option names.

As a first step towards avoiding this painful CLI experience, this gets
rid of the 'data' indirection internally: The QAPI parser doesn't use a
wrapper object as the variant type any more, so the indirection is
removed from the generated C types. As a result, the C type looks the
same for flat and simple unions now. A large part of this patch is
mechanical conversion of C code to remove the 'data' indirection.

Conceptually, the important change is that variants can now have flat
and wrapped representations. For a transitioning period, we'll allow
variants to support both representations in a later patch. Eventually,
the plan is to deprecate and remove wrapped representations entirely,
unifying simple and flat unions.

The externally visible interfaces stay unchanged: Visitors still expect
the 'data' wrappers, and introspection still shows it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>

breaks the build for me:

Other than that, I like the change, and it looks quite straightforward. I hope it's acceptable and we are not missing the reasons that extra data indirection was necessary.

Having to support both flat and wrapped versions in the externally visible interfaces might be tricky though.

Marc-André Lureau

reply via email to

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