From f1a8fcd7a7256d95244798a6aa60b82797ab9464 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 21 Feb 2018 22:27:19 -0500 Subject: [PATCH] qapi: Drop useless 'data' member of unions We started moving away from the use of the 'void *data' member in the C union corresponding to a QAPI union back in commit 544a373; recent commits have gotten rid of other uses. Now that it is completely unused, we can remove the member itself as well as the FIXME comment. Update the testsuite to drop the negative test union-clash-data. Backports commit 48eb62a74fc2d6b0ae9e5f414304a85cfbf33066 from qemu --- qemu/scripts/qapi-types.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/qemu/scripts/qapi-types.py b/qemu/scripts/qapi-types.py index d3f29d79..c20abba2 100644 --- a/qemu/scripts/qapi-types.py +++ b/qemu/scripts/qapi-types.py @@ -150,17 +150,8 @@ const int %(c_name)s_qtypes[QTYPE__MAX] = { def gen_variants(variants): - # FIXME: What purpose does data serve, besides preventing a union that - # has a branch named 'data'? We use it in qapi-visit.py to decide - # whether to bypass the switch statement if visiting the discriminator - # failed; but since we 0-initialize structs, and cannot tell what - # branch of the union is in use if the discriminator is invalid, there - # should not be any data leaks even without a data pointer. Or, if - # 'data' is merely added to guarantee we don't have an empty union, - # shouldn't we enforce that at .json parse time? ret = mcgen(''' union { /* union tag is @%(c_name)s */ - void *data; ''', c_name=c_name(variants.tag_member.name))