From nobody Tue Feb 10 16:22:40 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 1506958422955638.5391021694446; Mon, 2 Oct 2017 08:33:42 -0700 (PDT) Received: from localhost ([::1]:52849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2iv-0005YZ-4i for importer@patchew.org; Mon, 02 Oct 2017 11:33:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz2bg-000817-63 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz2bZ-0007u1-Er for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41498) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz2bZ-0007tR-5N for qemu-devel@nongnu.org; Mon, 02 Oct 2017 11:26:01 -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 3BD1F356D8; Mon, 2 Oct 2017 15:26:00 +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 D24D36F989; Mon, 2 Oct 2017 15:25:59 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A3326115627A; Mon, 2 Oct 2017 17:25:52 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3BD1F356D8 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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:31 +0200 Message-Id: <20171002152552.27999-12-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.30]); Mon, 02 Oct 2017 15:26:00 +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 11/32] qapi: Drop the options to generate only .c or .h 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" Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi-commands.py | 4 ++-- scripts/qapi-event.py | 4 ++-- scripts/qapi-introspect.py | 4 ++-- scripts/qapi-types.py | 4 ++-- scripts/qapi-visit.py | 4 ++-- scripts/qapi.py | 25 ++++--------------------- 6 files changed, 14 insertions(+), 31 deletions(-) diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 974d0a4a80..56a1009564 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -253,7 +253,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor): self._regy +=3D gen_register_command(name, success_response) =20 =20 -(input_file, output_dir, do_c, do_h, prefix, opts) =3D parse_command_line() +(input_file, output_dir, prefix, opts) =3D parse_command_line() =20 c_comment =3D ''' /* @@ -284,7 +284,7 @@ h_comment =3D ''' */ ''' =20 -(fdef, fdecl) =3D open_output(output_dir, do_c, do_h, prefix, +(fdef, fdecl) =3D open_output(output_dir, prefix, 'qmp-marshal.c', 'qmp-commands.h', c_comment, h_comment) =20 diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index 07b4b70199..0a308e6b69 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -169,7 +169,7 @@ class QAPISchemaGenEventVisitor(QAPISchemaVisitor): self._event_names.append(name) =20 =20 -(input_file, output_dir, do_c, do_h, prefix, dummy) =3D parse_command_line= () +(input_file, output_dir, prefix, dummy) =3D parse_command_line() =20 c_comment =3D ''' /* @@ -200,7 +200,7 @@ h_comment =3D ''' */ ''' =20 -(fdef, fdecl) =3D open_output(output_dir, do_c, do_h, prefix, +(fdef, fdecl) =3D open_output(output_dir, prefix, 'qapi-event.c', 'qapi-event.h', c_comment, h_comment) =20 diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py index 032bcea491..c2e46182c8 100644 --- a/scripts/qapi-introspect.py +++ b/scripts/qapi-introspect.py @@ -169,7 +169,7 @@ const char %(c_name)s[] =3D %(c_string)s; # We normally mask them, because they're not QMP wire ABI opt_unmask =3D False =20 -(input_file, output_dir, do_c, do_h, prefix, opts) =3D \ +(input_file, output_dir, prefix, opts) =3D \ parse_command_line('u', ['unmask-non-abi-names']) =20 for o, a in opts: @@ -199,7 +199,7 @@ h_comment =3D ''' */ ''' =20 -(fdef, fdecl) =3D open_output(output_dir, do_c, do_h, prefix, +(fdef, fdecl) =3D open_output(output_dir, prefix, 'qmp-introspect.c', 'qmp-introspect.h', c_comment, h_comment) =20 diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 7e3051dbb9..dc7dd08512 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -243,7 +243,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor): # QAPISchemaGenTypeVisitor.visit_end(). do_builtins =3D False =20 -(input_file, output_dir, do_c, do_h, prefix, opts) =3D \ +(input_file, output_dir, prefix, opts) =3D \ parse_command_line('b', ['builtins']) =20 for o, a in opts: @@ -280,7 +280,7 @@ h_comment =3D ''' */ ''' =20 -(fdef, fdecl) =3D open_output(output_dir, do_c, do_h, prefix, +(fdef, fdecl) =3D open_output(output_dir, prefix, 'qapi-types.c', 'qapi-types.h', c_comment, h_comment) =20 diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 7e1cfc13f0..9757911d2d 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -327,7 +327,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor): # QAPISchemaGenVisitVisitor.visit_end(). do_builtins =3D False =20 -(input_file, output_dir, do_c, do_h, prefix, opts) =3D \ +(input_file, output_dir, prefix, opts) =3D \ parse_command_line('b', ['builtins']) =20 for o, a in opts: @@ -363,7 +363,7 @@ h_comment =3D ''' */ ''' =20 -(fdef, fdecl) =3D open_output(output_dir, do_c, do_h, prefix, +(fdef, fdecl) =3D open_output(output_dir, prefix, 'qapi-visit.c', 'qapi-visit.h', c_comment, h_comment) =20 diff --git a/scripts/qapi.py b/scripts/qapi.py index 8f9c5666bd..5434987108 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1931,8 +1931,6 @@ def parse_command_line(extra_options=3D'', extra_long= _options=3D[]): =20 output_dir =3D '' prefix =3D '' - do_c =3D False - do_h =3D False extra_opts =3D [] =20 for oa in opts: @@ -1947,30 +1945,22 @@ def parse_command_line(extra_options=3D'', extra_lo= ng_options=3D[]): prefix =3D a elif o in ('-o', '--output-dir'): output_dir =3D a + '/' - elif o in ('-c', '--source'): - do_c =3D True - elif o in ('-h', '--header'): - do_h =3D True else: extra_opts.append(oa) =20 - if not do_c and not do_h: - do_c =3D True - do_h =3D True - if len(args) !=3D 1: print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0] sys.exit(1) fname =3D args[0] =20 - return (fname, output_dir, do_c, do_h, prefix, extra_opts) + return (fname, output_dir, prefix, extra_opts) =20 # # Generate output files with boilerplate # =20 =20 -def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, +def open_output(output_dir, prefix, c_file, h_file, c_comment, h_comment): guard =3D guardname(prefix + h_file) c_file =3D output_dir + prefix + c_file @@ -1983,15 +1973,8 @@ def open_output(output_dir, do_c, do_h, prefix, c_fi= le, h_file, if e.errno !=3D errno.EEXIST: raise =20 - def maybe_open(really, name, opt): - if really: - return open(name, opt) - else: - import StringIO - return StringIO.StringIO() - - fdef =3D maybe_open(do_c, c_file, 'w') - fdecl =3D maybe_open(do_h, h_file, 'w') + fdef =3D open(c_file, 'w') + fdecl =3D open(h_file, 'w') =20 fdef.write(mcgen(''' /* AUTOMATICALLY GENERATED, DO NOT MODIFY */ --=20 2.13.6