de3b3f529d
The C code generator fails to honor 'if' conditions of command and event arguments. For instance, tests/qapi-schema/qapi-schema-test.json has { 'event': 'TEST_IF_EVENT', 'data': { 'foo': 'TestIfStruct', 'bar': { 'type': ['str'], 'if': 'TEST_IF_EVT_ARG' } }, 'if': { 'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT'] } } Generated tests/test-qapi-events.h fails to honor the TEST_IF_EVT_ARG condition: #if defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT) void qapi_event_send_test_if_event(TestIfStruct *foo, strList *bar); #endif /* defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT) */ Only uses so far are in tests/. We could fix the generator to emit something like #if defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT) void qapi_event_send_test_if_event(TestIfStruct *foo #if defined(TEST_IF_EVT_ARG) , strList *bar #endif ); #endif /* defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT) */ Ugly. Calls become similarly ugly. Not worth fixing. Conditional arguments work fine with 'boxed': true, simply because complex types with conditional members work fine. Not worth breaking. Reject conditional arguments unless boxed. Move the tests cases covering unboxed conditional arguments out of tests/qapi-schema/qapi-schema-test.json. Cover boxed conditional arguments there instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230316071325.492471-15-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> |
||
---|---|---|
.. | ||
acpi-bits.rst | ||
atomics.rst | ||
bitops.rst | ||
blkdebug.txt | ||
blkverify.txt | ||
block-coroutine-wrapper.rst | ||
build-system.rst | ||
ci-definitions.rst.inc | ||
ci-jobs.rst.inc | ||
ci-runners.rst.inc | ||
ci.rst | ||
clocks.rst | ||
code-of-conduct.rst | ||
conflict-resolution.rst | ||
control-flow-integrity.rst | ||
decodetree.rst | ||
ebpf_rss.rst | ||
fuzzing.rst | ||
index-api.rst | ||
index-build.rst | ||
index-internals.rst | ||
index-process.rst | ||
index-tcg.rst | ||
index.rst | ||
kconfig.rst | ||
loads-stores.rst | ||
lockcnt.txt | ||
maintainers.rst | ||
memory.rst | ||
migration.rst | ||
modules.rst | ||
multi-process.rst | ||
multi-thread-tcg.rst | ||
multiple-iothreads.txt | ||
qapi-code-gen.rst | ||
qgraph.rst | ||
qom.rst | ||
qtest.rst | ||
rcu.txt | ||
replay.rst | ||
reset.rst | ||
s390-dasd-ipl.rst | ||
secure-coding-practices.rst | ||
stable-process.rst | ||
style.rst | ||
submitting-a-patch.rst | ||
submitting-a-pull-request.rst | ||
tcg-icount.rst | ||
tcg-ops.rst | ||
tcg-plugins.rst | ||
tcg.rst | ||
testing.rst | ||
tracing.rst | ||
trivial-patches.rst | ||
ui.rst | ||
vfio-migration.rst | ||
virtio-backends.rst | ||
virtio-migration.txt | ||
writing-monitor-commands.rst |