From patchwork Thu Feb 18 20:08:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 8354151 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2605B9F38B for ; Thu, 18 Feb 2016 20:13:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E93420395 for ; Thu, 18 Feb 2016 20:13:35 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id ED7C22024F for ; Thu, 18 Feb 2016 20:13:29 +0000 (UTC) Received: from localhost ([::1]:45124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWUx7-0004aS-A2 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Feb 2016 15:13:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWUsl-0005fe-6e for qemu-devel@nongnu.org; Thu, 18 Feb 2016 15:09:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWUsh-0001E8-Vh for qemu-devel@nongnu.org; Thu, 18 Feb 2016 15:08:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWUsh-0001E4-QI for qemu-devel@nongnu.org; Thu, 18 Feb 2016 15:08:55 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 797EA552E6 for ; Thu, 18 Feb 2016 20:08:55 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1IK8rPS000495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 18 Feb 2016 15:08:55 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3148D303F903; Thu, 18 Feb 2016 21:08:53 +0100 (CET) From: Markus Armbruster To: Eric Blake References: <1455778109-6278-1-git-send-email-eblake@redhat.com> Date: Thu, 18 Feb 2016 21:08:53 +0100 In-Reply-To: <1455778109-6278-1-git-send-email-eblake@redhat.com> (Eric Blake's message of "Wed, 17 Feb 2016 23:48:14 -0700") Message-ID: <877fi1ye5m.fsf@blackfin.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH v11 00/15] prune some QAPI visitor cruft (was qapi cleanups subset E) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Eric Blake writes: > I'm still working on my documentation patches for QAPI visitors > (https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg03504.html), > but am finding it easier to nuke bad code up front than to document > that it is bad only to later nuke it. So this pulls bits and pieces > of other patches that Markus I have previously posted, along with > some new glue, to get rid of some of the worst of the cruft. > > v10 was here: > https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg03282.html > > Since then, I've folded in fixes for Markus' review comments, > including rearranging some hunks and retitling some patches, > and dropping the attempt to minimize generated gotos. The biggest > changes are moving where variants get visited (during > visit_type_FOO_fields() rather than visit_type_FOO()), dropping > visit_type_alternate_FOO() (open-coding it during > gen_visit_alternate()), and fixing bugs (properly handle > visit_start_union() so that there are no bisection points where > we are handling 'void *data' incorrectly). > > 001/15:[----] [--] 'qapi: Simplify excess input reporting in input visitors' > 002/15:[----] [--] 'qapi: Forbid empty unions and useless alternates' > 003/15:[down] 'qapi: Forbid 'any' inside an alternate' > 004/15:[down] 'qapi: Add tests of complex objects within alternate' > 005/15:[----] [--] 'qapi-visit: Simplify how we visit common union members' > 006/15:[down] 'qapi: Visit variants in visit_type_FOO_fields()' > 007/15:[0051] [FC] 'qapi-visit: Unify struct and union visit' > 008/15:[0012] [FC] 'qapi-visit: Less indirection in visit_type_Foo_fields()' > 009/15:[0002] [FC] 'qapi: Adjust layout of FooList types' > 010/15:[0004] [FC] 'qapi: Emit structs used as variants in topological order' > 011/15:[down] 'qapi-visit: Use common idiom in gen_visit_fields_decl()' > 012/15:[0148] [FC] 'qapi: Don't box struct branch of alternate' > 013/15:[0074] [FC] 'qapi: Don't box branches of flat unions' > 014/15:[down] 'qapi: Delete visit_start_union(), gen_visit_implicit_struct()' > 015/15:[0001] [FC] 'qapi: Change visit_start_implicit_struct to visit_start_alternate' Applied to qapi-next with minor tweaks. Diff between the final appended. I'd appreciate a look-over. Thanks! --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -41,7 +41,7 @@ static void visit_type_%(c_type)s_fields(Visitor *v, %(c_type)s *obj, Error **er c_type=typ.c_name()) -def gen_visit_struct_fields(name, base, members, variants=None): +def gen_visit_struct_fields(name, base, members, variants): ret = '' if base: