[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/6] qapi: Remove wrapper struct for simple unions
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 3/6] qapi: Remove wrapper struct for simple unions |
Date: |
Fri, 23 Oct 2020 14:49:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Marc-André Lureau <marcandre.lureau@gmail.com> writes:
> Hi
>
> 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:
>
> ../chardev/spice.c: In function ‘qemu_chr_open_spice_vmc’:
> ../chardev/spice.c:261:56: error: ‘ChardevSpiceChannel’ has no member named
> ‘data’
> 261 | ChardevSpiceChannel *spicevmc = backend->u.spicevmc.data;
> | ^
> ../chardev/spice.c: In function ‘qemu_chr_open_spice_port’:
> ../chardev/spice.c:297:55: error: ‘ChardevSpicePort’ has no member named
> ‘data’
> 297 | ChardevSpicePort *spiceport = backend->u.spiceport.data;
> | ^
> ../chardev/spice.c: In function ‘qemu_chr_parse_spice_vmc’:
> ../chardev/spice.c:331:35: error: ‘ChardevSpiceChannel’ has no member named
> ‘data’
> 331 | spicevmc = backend->u.spicevmc.data =
> g_new0(ChardevSpiceChannel, 1);
> | ^
> ../chardev/spice.c: In function ‘qemu_chr_parse_spice_port’:
> ../chardev/spice.c:347:37: error: ‘ChardevSpicePort’ has no member named
> ‘data’
> 347 | spiceport = backend->u.spiceport.data =
> g_new0(ChardevSpicePort, 1);
> | ^
> ../ui/spice-app.c: In function ‘chr_spice_backend_new’:
> ../ui/spice-app.c:63:20: error: ‘ChardevSpicePort’ has no member named
> ‘data’
> 63 | be->u.spiceport.data = g_new0(ChardevSpicePort, 1);
> | ^
> ../ui/spice-app.c: In function ‘vc_chr_open’:
> ../ui/spice-app.c:86:20: error: ‘ChardevSpicePort’ has no member named
> ‘data’
> 86 | be->u.spiceport.data->fqdn = fqdn ?
> | ^
> ../ui/spice-app.c: In function ‘spice_app_display_init’:
> ../ui/spice-app.c:185:20: error: ‘ChardevSpicePort’ has no member named
> ‘data’
> 185 | be->u.spiceport.data->fqdn = g_strdup("org.qemu.monitor.qmp.0");
> | ^
In addition to that, I get
/usr/bin/sphinx-build-3 -Dversion=5.1.50 -Drelease=
-Ddepfile=docs/interop.d -Ddepfile_stamp=docs/interop.stamp -b html -d
/work/armbru/qemu/bld-x86/docs/interop.p /work/armbru/qemu/docs/interop
/work/armbru/qemu/bld-x86/docs/interop
Running Sphinx v2.2.2
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 12 source files that are out of date
updating environment: [new config] 12 added, 0 changed, 0 removed
reading sources... [ 8%] bitmaps
reading sources... [ 16%] dbus
reading sources... [ 25%] dbus-vmstate
reading sources... [ 33%] index
reading sources... [ 41%] live-block-operations
reading sources... [ 50%] pr-helper
reading sources... [ 58%] qemu-ga
reading sources... [ 66%] qemu-ga-ref
reading sources... [ 75%] qemu-qmp-ref
Exception occurred:
File "/work/armbru/qemu/docs/sphinx/qapidoc.py", line 187, in
_nodes_for_members
assert not v.type.base and not v.type.variants
AttributeError: 'QAPISchemaBuiltinType' object has no attribute 'base'
The full traceback has been saved in /tmp/sphinx-err-fq8tq1i7.log, if you
want to report the issue to the developers.
Please also report this if it was a user error, so that a better error
message can be provided next time.
A bug report can be filed in the tracker at
<https://github.com/sphinx-doc/sphinx/issues>. Thanks!
- [PATCH 1/6] char/stdio: Fix QMP default for 'signal', (continued)
[PATCH 5/6] tests/qapi-schema: Flat representation of simple unions, Kevin Wolf, 2020/10/23
[PATCH 6/6] qemu-storage-daemon: Use qmp_chardev_add() for --chardev, Kevin Wolf, 2020/10/23
[PATCH 4/6] qapi: Optionally parse simple unions as flat, Kevin Wolf, 2020/10/23
Re: [PATCH 0/6] qemu-storage-daemon: QAPIfy --chardev, Daniel P . Berrangé, 2020/10/23