From patchwork Thu Jun 23 00:08:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9194269 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 818D6601C0 for ; Thu, 23 Jun 2016 00:13:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 726622841B for ; Thu, 23 Jun 2016 00:13:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66F6B28428; Thu, 23 Jun 2016 00:13:21 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5A32B2841B for ; Thu, 23 Jun 2016 00:13:20 +0000 (UTC) Received: from localhost ([::1]:33225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFsGl-0007Ww-D6 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Jun 2016 20:13:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFsCA-0003fo-2x for qemu-devel@nongnu.org; Wed, 22 Jun 2016 20:08:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFsC3-0004Qg-Cg for qemu-devel@nongnu.org; Wed, 22 Jun 2016 20:08:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFsC3-0004QR-70 for qemu-devel@nongnu.org; Wed, 22 Jun 2016 20:08:27 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4399C0467C8 for ; Thu, 23 Jun 2016 00:08:26 +0000 (UTC) Received: from localhost (ovpn-116-150.phx2.redhat.com [10.3.116.150]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5N08P7b003814; Wed, 22 Jun 2016 20:08:26 -0400 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 23 Jun 2016 02:08:06 +0200 Message-Id: <20160623000809.4522-10-marcandre.lureau@redhat.com> In-Reply-To: <20160623000809.4522-1-marcandre.lureau@redhat.com> References: <20160623000809.4522-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 23 Jun 2016 00:08:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/12] qapi: remove the "middle" mode 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , armbru@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau Now that the register function is always generated, we can remove the so-called "middle" mode from the generator script. Signed-off-by: Marc-André Lureau --- scripts/qapi-commands.py | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 8d25701..70a07b3 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -84,17 +84,8 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out, def gen_marshal_proto(name): - ret = 'void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)' % c_name(name) - if not middle_mode: - ret = 'static ' + ret - return ret - - -def gen_marshal_decl(name): - return mcgen(''' -%(proto)s; -''', - proto=gen_marshal_proto(name)) + return 'static void qmp_marshal_%s' % c_name(name) + \ + '(QDict *args, QObject **ret, Error **errp)' def gen_marshal(name, arg_type, box, ret_type): @@ -209,8 +200,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor): self._visited_ret_types = set() def visit_end(self): - if not middle_mode: - self.defn += gen_registry(self._regy) + self.defn += gen_registry(self._regy) self._regy = None self._visited_ret_types = None @@ -222,21 +212,12 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor): if ret_type and ret_type not in self._visited_ret_types: self._visited_ret_types.add(ret_type) self.defn += gen_marshal_output(ret_type) - if middle_mode: - self.decl += gen_marshal_decl(name) self.defn += gen_marshal(name, arg_type, box, ret_type) - if not middle_mode: - self._regy += gen_register_command(name, success_response) - + self._regy += gen_register_command(name, success_response) -middle_mode = False (input_file, output_dir, do_c, do_h, prefix, opts) = \ - parse_command_line("m", ["middle"]) - -for o, a in opts: - if o in ("-m", "--middle"): - middle_mode = True + parse_command_line() c_comment = ''' /*