summary refs log tree commit diff stats
path: root/tests/qapi-schema
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2021-08-06 14:05:10 +0200
committerMarkus Armbruster <armbru@redhat.com>2021-08-26 13:53:56 +0200
commitb32abbb2f563ca26c0f87e848d46e1001568b7f6 (patch)
tree0ab9b70d8eb3310fac20d7218ce7072c86e89bbc /tests/qapi-schema
parentd8ae530ec00368d4adfb996b5ef6c74cb4460504 (diff)
downloadfocaccia-qemu-b32abbb2f563ca26c0f87e848d46e1001568b7f6.tar.gz
focaccia-qemu-b32abbb2f563ca26c0f87e848d46e1001568b7f6.zip
qapi: Fix crash on redefinition with a different condition
QAPISchema._make_implicit_object_type() asserts that when an implicit
object type is used multiple times, @ifcond is the same for all uses.
It will be for legitimate uses, i.e. simple union branch wrapper
types.  A comment explains this.

The assertion fails when a command or event is redefined with a
different condition.  The redefinition is an error, but it's flagged
only later.

Fixing the assertion would complicate matters further.  Not
worthwhile, drop it instead.  We really need to get rid of simple
unions.

Tweak test case redefined-event to cover redefinition with a different
condition.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210806120510.2367124-1-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r--tests/qapi-schema/redefined-event.json2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/qapi-schema/redefined-event.json b/tests/qapi-schema/redefined-event.json
index 7717e91c18..09eff18412 100644
--- a/tests/qapi-schema/redefined-event.json
+++ b/tests/qapi-schema/redefined-event.json
@@ -1,3 +1,3 @@
 # we reject duplicate events
 { 'event': 'EVENT_A', 'data': { 'myint': 'int' } }
-{ 'event': 'EVENT_A', 'data': { 'myint': 'int' } }
+{ 'event': 'EVENT_A', 'data': { 'myint': 'int' }, 'if': 'defined(FOO)' }