From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVfDR-0003bN-M6 for qemu-devel@nongnu.org; Fri, 05 Aug 2016 09:31:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVfDO-0000WD-Fj for qemu-devel@nongnu.org; Fri, 05 Aug 2016 09:31:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVfDO-0000W7-7a for qemu-devel@nongnu.org; Fri, 05 Aug 2016 09:31:06 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 B50A0C0624A2 for ; Fri, 5 Aug 2016 13:31:04 +0000 (UTC) From: Markus Armbruster References: <20160721140030.28383-1-marcandre.lureau@redhat.com> <20160721140030.28383-10-marcandre.lureau@redhat.com> Date: Fri, 05 Aug 2016 15:31:02 +0200 In-Reply-To: <20160721140030.28383-10-marcandre.lureau@redhat.com> (marcandre lureau's message of "Thu, 21 Jul 2016 18:00:27 +0400") Message-ID: <87y44btka1.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 09/12] qapi: remove the "middle" mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org marcandre.lureau@redhat.com writes: > From: Marc-Andr=C3=A9 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=C3=A9 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 a06a2c4..4754ae0 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 r= et_in, QObject **ret_out, >=20=20 >=20=20 > def gen_marshal_proto(name): > - ret =3D 'void qmp_marshal_%s(QDict *args, QObject **ret, Error **err= p)' % c_name(name) > - if not middle_mode: > - ret =3D 'static ' + ret > - return ret > - > - > -def gen_marshal_decl(name): > - return mcgen(''' > -%(proto)s; > -''', > - proto=3Dgen_marshal_proto(name)) > + return 'static void qmp_marshal_%s' % c_name(name) + \ > + '(QDict *args, QObject **ret, Error **errp)' Eric's suggestion to use mcgen() here seconded. >=20=20 >=20=20 > def gen_marshal(name, arg_type, boxed, ret_type): > @@ -209,8 +200,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor): > self._visited_ret_types =3D set() >=20=20 > def visit_end(self): > - if not middle_mode: > - self.defn +=3D gen_registry(self._regy) > + self.defn +=3D gen_registry(self._regy) > self._regy =3D None > self._visited_ret_types =3D None >=20=20 > @@ -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 +=3D gen_marshal_output(ret_type) > - if middle_mode: > - self.decl +=3D gen_marshal_decl(name) > self.defn +=3D gen_marshal(name, arg_type, boxed, ret_type) > - if not middle_mode: > - self._regy +=3D gen_register_command(name, success_response) > - > + self._regy +=3D gen_register_command(name, success_response) >=20=20 > -middle_mode =3D False >=20=20 > (input_file, output_dir, do_c, do_h, prefix, opts) =3D \ > - parse_command_line("m", ["middle"]) > - > -for o, a in opts: > - if o in ("-m", "--middle"): > - middle_mode =3D True > + parse_command_line() >=20=20 > c_comment =3D ''' > /* Let's get rid of the line continuation, too: (input_file, output_dir, do_c, do_h, prefix, opts) =3D parse_command_lin= e()