From nobody Tue Feb 10 16:22:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506958612227333.2873302851584; Mon, 2 Oct 2017 08:36:52 -0700 (PDT) Received: from localhost ([::1]:52866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2ls-00084C-8D for importer@patchew.org; Mon, 02 Oct 2017 11:36:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2bc-0007yJ-7b for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2ba-0007vG-81 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2ba-0007uB-2C for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 113FDBDE3; Mon, 2 Oct 2017 15:26:01 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BED16F999; Mon, 2 Oct 2017 15:26:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AF7C411562E2; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 113FDBDE3 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 17:25:35 +0200 Message-Id: <20171002152552.27999-16-armbru@redhat.com> In-Reply-To: <20171002152552.27999-1-armbru@redhat.com> References: <20171002152552.27999-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 02 Oct 2017 15:26:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 15/32] tests/qapi-schema: Improve simple union coverage X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This demonstrates a bug in the lowering of simple unions: if more than one schema uses the same built-in type T for a simple union member, they all generate the same q_obj_T_wrapper into their qapi-types.h. They clash when you include more than one schema's qapi-types.h. Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/qapi-schema/qapi-schema-test.json | 6 ++++++ tests/qapi-schema/qapi-schema-test.out | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index c72dbd8050..c091626635 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -82,6 +82,12 @@ 'base': 'UserDefZero', 'data': { 'string': 'str', 'enum1': 'EnumOne' } } =20 +{ 'union': 'UserDefSimpleUnion', + 'data': { 'value1': 'UserDefA', +# FIXME generated q_obj_int_wrapper clashes with qapi-schema.json's +# 'value2': 'int', + 'value3': 'UserDefB' } } + # this variant of UserDefFlatUnion defaults to a union that uses members w= ith # allocated types to test corner cases in the cleanup/dealloc visitor { 'union': 'UserDefFlatUnion2', diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 4b42db23b2..97bb02f2fd 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -108,6 +108,12 @@ object UserDefOptions member u16: uint16List optional=3DTrue member i64x: int optional=3DTrue member u64x: uint64 optional=3DTrue +object UserDefSimpleUnion + member type: UserDefSimpleUnionKind optional=3DFalse + tag type + case value1: q_obj_UserDefA-wrapper + case value3: q_obj_UserDefB-wrapper +enum UserDefSimpleUnionKind ['value1', 'value3'] object UserDefTwo member string0: str optional=3DFalse member dict1: UserDefTwoDict optional=3DFalse @@ -169,6 +175,10 @@ object q_obj_EVENT_D-arg member b: str optional=3DFalse member c: str optional=3DTrue member enum3: EnumOne optional=3DTrue +object q_obj_UserDefA-wrapper + member data: UserDefA optional=3DFalse +object q_obj_UserDefB-wrapper + member data: UserDefB optional=3DFalse object q_obj_UserDefFlatUnion2-base member integer: int optional=3DTrue member string: str optional=3DFalse --=20 2.13.6