From patchwork Tue May 29 16:41:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10436443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 578D3602BF for ; Tue, 29 May 2018 16:44:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4479E2018F for ; Tue, 29 May 2018 16:44:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38D2228944; Tue, 29 May 2018 16:44:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48D362018F for ; Tue, 29 May 2018 16:44:39 +0000 (UTC) Received: from localhost ([::1]:33959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNhji-0004Qz-HX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 May 2018 12:44:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNhh1-0002Wc-Ua for qemu-devel@nongnu.org; Tue, 29 May 2018 12:41:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNhgx-0003tF-FZ for qemu-devel@nongnu.org; Tue, 29 May 2018 12:41:51 -0400 Received: from mail-db5eur01on0139.outbound.protection.outlook.com ([104.47.2.139]:7424 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fNhgx-0003qD-87 for qemu-devel@nongnu.org; Tue, 29 May 2018 12:41:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dUnBTEYvxNvWC3eFiKlsVqKxrdT4UYPpPoO0inzcS+0=; b=bCe2Jkg1EcJHd83nxCVoa4NFMbyn3eJNWwGyQykz7odmdRiHp5bfuXtV8XMs3wUGRu7St2HS9E9MVrpF8RSvGDA1r90Prukp02vc645vkDEnAhRJ5vF+IM8zmUxUi2knJPKdsrQyvwDHTD8DuUXe+mV2sku0d3fk0x8DinSTTnE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by AM0PR08MB3345.eurprd08.prod.outlook.com (2603:10a6:208:5f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.797.11; Tue, 29 May 2018 16:41:45 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 29 May 2018 19:41:31 +0300 Message-Id: <1527612092-65980-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527612092-65980-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1527612092-65980-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0102CA0008.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::21) To AM0PR08MB3345.eurprd08.prod.outlook.com (2603:10a6:208:5f::18) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3345; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3345; 3:75xlft+tpPDop+iyYu29jeAmL5e1K0vvDkCkwf+WzlcvJ06JGAp2wr+pSzFNqa0UW+a86jR1sMmUZxOAEgJUcOT4utfGHFUDJEQweAonQKVqWlRKUZAqfoD9XUfDt3KOJ6Lf8u4o8bG2WLVCPozxAAlBw90nxKH4hhnMRb9zR2hOpUp3J/W1l5Erg0X/UExdg25071/gZPXPhccRpurl+V62z2VztNknSGLNdk2Kape/9xfappEs4h9vCM4E2tFu; 25:6xL9CMmZECTDXfLF5+mMP2d6SPrS/oDKizTfu+D/xk1qlK7GDEkTnbHw1Q1o9c2tL5+hJ2C19xEZQVMG02HjhclFapRcRrMEmrbhM1j+IniZY+Xx43cftMK39pCtJE0iuVN3KJI6ZzNsfPz66+gDXqThCQ8rrk2Hx42vUendH5BPJ2rGG/n4MfpzJYswtS1U/awr2kmFjhzKIpQQ259gl2zXaOob8jlrHAYZktRjuyCGZ7UdbXHXGlv6WlADT6B4bxdINsO2xuTKT7zVwMq6Wc57m8enC3Z8bYBMCdYQbXlEemSTawbbsEb26n+vMYQ012YiuSyIW2vBQArj6nlzxQ==; 31:y2cxKpyxHu4mmhq8PJZJDE4ePLCZFYgClX4vJJ+wFXc9Jn1NB+q4jRMtR2XtPFMlgrIfFzpk28D/KM3jLusoW835k1ME7lZ/qrpdIYUaHb2fnSr3N/46PWlNtmCC6aVzz750NzUVuzsxDeFfZmVd9FWMS0RRW9NcAbADWAYTJ+4xiAo4KLdszthC2IvPo81zvZg7Ndb/X2vWBeloEe2Bgbc8JXYoF6VwYQS0xSPj/5U= X-MS-TrafficTypeDiagnostic: AM0PR08MB3345: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3345; 20:4FEt0Zch6X3u9jMXl3qmSQ/mA5yTmdHMGIB3+9JYQeOv5iKoRkdEHQThyhxXCr8BsR9JVJG0zMcN2PhO5CGBe1HC3WL8nNk+Wm/eMBhShX8ftFC+8OZivv6SWRe38l17UslYViXCu8TcFsp9C6L2sbyM6DkYNorXs1d/tse7r9N3KO1ofMFtA2hYTNk6dUwtmmnjXwe6IOu03U5czlH9xuxfB0thafzBgWNCOagzH1a235T7/oxw3F0zeT4PE8jnIw+LO9GpaGzbzIe/d+XQfDa07JTGlWNVUYkGDz4l1RB9jMpnb/DTXLjqYv5NrmMz1/d8h7MF8+RCU1LMEymkGOlvCt2PNS9YOUK/oFnlb/lBvipE+m8iEUVlBA3DzwqRI4VWbJ3S/VarUktuHMq/M9ccMy5tSCs0Svr5wG+0FNMlVM82buZI1Vpv7M1+AhVX7EX3MOmCmiQ0ZxzKi3EQkXw7ZvQLx3DJW6GzNA0hIprB+eq75m4Iio2sW/QOPA5P; 4:7xTFZAw6Q90Zvp08pVHPC0ViOFj6Kx+ljGbeGjCHLDf9byaRTWs2M/2G53Tm9GNJOPOxrmYrWtq7meZNOJ1GXlKwXZ0uP97jLmiVIB2NqgLl/tiNVYOJBm62e8OkgrUdHb1QgQ9+kmcamqlqD3bI3ehKXKBzpWWiDCYxO9pnjZAQuBAVEdBn4N2I/b2aupUMwTP24kioLFAVApoS/dbAlXuD0LN1r9xkPxlK0T4CTM8gs22gQpWgWbaw1oBDC3KjDfU9MWsR7rdaPjStMnaw2Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:AM0PR08MB3345; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3345; X-Forefront-PRVS: 0687389FB0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(366004)(376002)(396003)(39850400004)(39380400002)(346002)(199004)(189003)(76176011)(50226002)(8676002)(6512007)(106356001)(48376002)(97736004)(50466002)(105586002)(4326008)(59450400001)(51416003)(107886003)(478600001)(52116002)(25786009)(68736007)(81166006)(81156014)(53416004)(8936002)(2616005)(2361001)(36756003)(956004)(6486002)(446003)(476003)(47776003)(66066001)(11346002)(53936002)(7736002)(16586007)(44832011)(2351001)(3846002)(486006)(6116002)(26005)(6506007)(5660300001)(69596002)(305945005)(575784001)(86362001)(2906002)(186003)(316002)(6916009)(55236004)(6666003)(386003)(16526019)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3345; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3345; 23:EoxpE2QWXvcwjmoeaMe82ivwPVXm9/JFYjyxe4hsZ?= =?us-ascii?Q?RvWS3Ta/kNFcZa4YVkjHoy707G3UFiVts6FYyGkaNMr4C8xANeAry/X9+WNc?= =?us-ascii?Q?L2k1jEE0CPuAz+V4PHaS9Xv930tT3P76jafVfklx6p2URkv7uzlDdkF5s7Wa?= =?us-ascii?Q?5FBYdlhnimvR24brMa5V2xsDipwoVS7p/vcSrgSmkQZ5kCUZY8TxEx+DS/xB?= =?us-ascii?Q?NubKyhHkhWiPLIYkICCt8EuTUH827WvaazET2xhldLNfddanAG452KQ5yM2y?= =?us-ascii?Q?LLwe/00DgUeyZMJhIzmq1/Qv9XLlDqCRojY1ZV93sDTaGjDFK4/fvzSFYfpA?= =?us-ascii?Q?oysHz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RUH/tMh1LYs1QGyZ8+dX0hqFdgPOZEmeRez+XdhJrmkOr64HnjV/4vupu3+XuHCjtlvLF19yB2SjdOpiNDl7PelP50Yq/8O6Vqki7HgM0HXg2XUjSBIAQgAk=; 24:dQJodju6zFeM0uAHbTl0vWGg83x4xfPF/V4Lr/m4rW0GTs/qFp2tovDwXfMvSVJPEoFe7unXay0ac86wVqK3jsSjeU947Y1vg8tKftxJ8kc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3345; 7:sRUBNg5Y6RwVHhlnkD0RV8gZGeJujDiprDPd8NmvSfXr4QTN38p++zoKRqkPwX6LHzu4YeFQ1ji+O8HdXnZemZMRMjNltaJ6XyR85dn/BDXPJr4/LXU+RaDKLhUh8xnWQevBVzQoEvXfmz8YEVOwAqgz3ow5gpiQakiQARpBhtfE/LZTCOKoLuux+Sy41eEX4qOf2GDkFswjA+DqCsuSFGc9eeebNRJvmJ5RnkujsvzoA/fQOa22N9O6TWt+1SmB; 20:ij3u66n4fstCRaJx0wY9xNf3kb7yqM1EvBn64n17vnWGrDrYlgy6BRVPg2GQHmqo0Ms/AkPNbqAkmDBLHyTNO0WnR3f1Rd2HuTTvI2enSRiQreIwORjfj79ySCMxtdR7sq6qFlk/ZaMrWR2whKgds+VOkm5c9qI159eVIlT+rU8= X-MS-Office365-Filtering-Correlation-Id: b8a4f724-ddb8-4f0e-9a0b-08d5c58310ff X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2018 16:41:45.5134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8a4f724-ddb8-4f0e-9a0b-08d5c58310ff X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3345 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.139 Subject: [Qemu-devel] [PATCH v2 1/2] qapi: allow empty branches in flat unions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anton Nefedov , armbru@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration. Both options create redundant entities in qapi files for little profit. With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration. Signed-off-by: Anton Nefedov --- docs/devel/qapi-code-gen.txt | 7 ++++--- scripts/qapi/common.py | 11 ++++------- scripts/qapi/types.py | 4 +++- scripts/qapi/visit.py | 17 +++++++++++++---- tests/qapi-schema/flat-union-incomplete-branch.err | 1 - tests/qapi-schema/flat-union-incomplete-branch.exit | 2 +- tests/qapi-schema/flat-union-incomplete-branch.out | 14 ++++++++++++++ 7 files changed, 39 insertions(+), 17 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index b9b6eab..a3ea450 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -496,9 +496,10 @@ Resulting in these JSON objects: Notice that in a flat union, the discriminator name is controlled by the user, but because it must map to a base member with enum type, the -code generator can ensure that branches exist for all values of the -enum (although the order of the keys need not match the declaration of -the enum). In the resulting generated C data types, a flat union is +code generator ensures that branches match the existing values of the +enum. The order of the keys need not match the declaration of the enum. +The keys need not cover all possible enum values. +In the resulting generated C data types, a flat union is represented as a struct with the base members included directly, and then a union of structures for each branch of the struct. diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index a032cec..df6190a 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -782,13 +782,6 @@ def check_union(expr, info): "enum '%s'" % (key, enum_define['enum'])) - # If discriminator is user-defined, ensure all values are covered - if enum_define: - for value in enum_define['data']: - if value not in members.keys(): - raise QAPISemError(info, "Union '%s' data missing '%s' branch" - % (name, value)) - def check_alternate(expr, info): name = expr['alternate'] @@ -1644,6 +1637,10 @@ class QAPISchema(object): if tag_name: variants = [self._make_variant(key, value) for (key, value) in data.items()] + # branches that are not explicitly covered get an empty type + variants += [self._make_variant(key, 'q_empty') + for key in discriminator_find_enum_define(expr)['data'] + if key not in data.keys()] members = [] else: variants = [self._make_simple_variant(key, value, info) diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 64d9c0f..1fb2b6d 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -124,7 +124,9 @@ def gen_variants(variants): ''', c_name=c_name(variants.tag_member.name)) - for var in variants.variants: + # filter out the empty types + for var in filter(lambda var: var.type.name != 'q_empty', + variants.variants): ret += mcgen(''' %(c_type)s %(c_name)s; ''', diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 5d72d89..96bd32c 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -81,14 +81,23 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) c_name=c_name(variants.tag_member.name)) for var in variants.variants: - ret += mcgen(''' + case_str = c_enum_const(variants.tag_member.type.name, + var.name, + variants.tag_member.type.prefix) + if var.type.name == 'q_empty': + # valid variant and nothing to do + ret += mcgen(''' + case %(case)s: + break; +''', + case=case_str) + else: + ret += mcgen(''' case %(case)s: visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err); break; ''', - case=c_enum_const(variants.tag_member.type.name, - var.name, - variants.tag_member.type.prefix), + case=case_str, c_type=var.type.c_name(), c_name=c_name(var.name)) ret += mcgen(''' diff --git a/tests/qapi-schema/flat-union-incomplete-branch.err b/tests/qapi-schema/flat-union-incomplete-branch.err index e826bf0..e69de29 100644 --- a/tests/qapi-schema/flat-union-incomplete-branch.err +++ b/tests/qapi-schema/flat-union-incomplete-branch.err @@ -1 +0,0 @@ -tests/qapi-schema/flat-union-incomplete-branch.json:6: Union 'TestUnion' data missing 'value2' branch diff --git a/tests/qapi-schema/flat-union-incomplete-branch.exit b/tests/qapi-schema/flat-union-incomplete-branch.exit index d00491f..573541a 100644 --- a/tests/qapi-schema/flat-union-incomplete-branch.exit +++ b/tests/qapi-schema/flat-union-incomplete-branch.exit @@ -1 +1 @@ -1 +0 diff --git a/tests/qapi-schema/flat-union-incomplete-branch.out b/tests/qapi-schema/flat-union-incomplete-branch.out index e69de29..4e774bc 100644 --- a/tests/qapi-schema/flat-union-incomplete-branch.out +++ b/tests/qapi-schema/flat-union-incomplete-branch.out @@ -0,0 +1,14 @@ +object q_empty +enum QType ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool'] + prefix QTYPE +module flat-union-incomplete-branch.json +enum TestEnum ['value1', 'value2'] +object TestTypeA + member string: str optional=False +object q_obj_TestUnion-base + member type: TestEnum optional=False +object TestUnion + base q_obj_TestUnion-base + tag type + case value1: TestTypeA + case value2: q_empty