From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, marcandre.lureau@redhat.com,
eblake@redhat.com
Subject: [Qemu-devel] [RFC PATCH 11/32] qapi: Drop the options to generate only .c or .h
Date: Mon, 2 Oct 2017 17:25:31 +0200 [thread overview]
Message-ID: <20171002152552.27999-12-armbru@redhat.com> (raw)
In-Reply-To: <20171002152552.27999-1-armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
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 += gen_register_command(name, success_response)
-(input_file, output_dir, do_c, do_h, prefix, opts) = parse_command_line()
+(input_file, output_dir, prefix, opts) = parse_command_line()
c_comment = '''
/*
@@ -284,7 +284,7 @@ h_comment = '''
*/
'''
-(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix,
+(fdef, fdecl) = open_output(output_dir, prefix,
'qmp-marshal.c', 'qmp-commands.h',
c_comment, h_comment)
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)
-(input_file, output_dir, do_c, do_h, prefix, dummy) = parse_command_line()
+(input_file, output_dir, prefix, dummy) = parse_command_line()
c_comment = '''
/*
@@ -200,7 +200,7 @@ h_comment = '''
*/
'''
-(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix,
+(fdef, fdecl) = open_output(output_dir, prefix,
'qapi-event.c', 'qapi-event.h',
c_comment, h_comment)
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[] = %(c_string)s;
# We normally mask them, because they're not QMP wire ABI
opt_unmask = False
-(input_file, output_dir, do_c, do_h, prefix, opts) = \
+(input_file, output_dir, prefix, opts) = \
parse_command_line('u', ['unmask-non-abi-names'])
for o, a in opts:
@@ -199,7 +199,7 @@ h_comment = '''
*/
'''
-(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix,
+(fdef, fdecl) = open_output(output_dir, prefix,
'qmp-introspect.c', 'qmp-introspect.h',
c_comment, h_comment)
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 = False
-(input_file, output_dir, do_c, do_h, prefix, opts) = \
+(input_file, output_dir, prefix, opts) = \
parse_command_line('b', ['builtins'])
for o, a in opts:
@@ -280,7 +280,7 @@ h_comment = '''
*/
'''
-(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix,
+(fdef, fdecl) = open_output(output_dir, prefix,
'qapi-types.c', 'qapi-types.h',
c_comment, h_comment)
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 = False
-(input_file, output_dir, do_c, do_h, prefix, opts) = \
+(input_file, output_dir, prefix, opts) = \
parse_command_line('b', ['builtins'])
for o, a in opts:
@@ -363,7 +363,7 @@ h_comment = '''
*/
'''
-(fdef, fdecl) = open_output(output_dir, do_c, do_h, prefix,
+(fdef, fdecl) = open_output(output_dir, prefix,
'qapi-visit.c', 'qapi-visit.h',
c_comment, h_comment)
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='', extra_long_options=[]):
output_dir = ''
prefix = ''
- do_c = False
- do_h = False
extra_opts = []
for oa in opts:
@@ -1947,30 +1945,22 @@ def parse_command_line(extra_options='', extra_long_options=[]):
prefix = a
elif o in ('-o', '--output-dir'):
output_dir = a + '/'
- elif o in ('-c', '--source'):
- do_c = True
- elif o in ('-h', '--header'):
- do_h = True
else:
extra_opts.append(oa)
- if not do_c and not do_h:
- do_c = True
- do_h = True
-
if len(args) != 1:
print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0]
sys.exit(1)
fname = args[0]
- return (fname, output_dir, do_c, do_h, prefix, extra_opts)
+ return (fname, output_dir, prefix, extra_opts)
#
# Generate output files with boilerplate
#
-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 = guardname(prefix + h_file)
c_file = output_dir + prefix + c_file
@@ -1983,15 +1973,8 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file,
if e.errno != errno.EEXIST:
raise
- def maybe_open(really, name, opt):
- if really:
- return open(name, opt)
- else:
- import StringIO
- return StringIO.StringIO()
-
- fdef = maybe_open(do_c, c_file, 'w')
- fdecl = maybe_open(do_h, h_file, 'w')
+ fdef = open(c_file, 'w')
+ fdecl = open(h_file, 'w')
fdef.write(mcgen('''
/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
--
2.13.6
next prev parent reply other threads:[~2017-10-02 15:26 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 15:25 [Qemu-devel] [RFC PATCH 00/32] Command line QAPIfication Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 01/32] tests/qapi-schema: Improve coverage of '@' Markus Armbruster
2017-10-04 10:37 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 02/32] texi2pod: Support @verbatim environment Markus Armbruster
2017-10-05 14:58 ` Eric Blake
2017-10-06 5:24 ` Markus Armbruster
2017-10-06 13:40 ` Eric Blake
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 03/32] qapi2texi: Fix for examples containing '@' Markus Armbruster
2017-10-04 10:45 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 04/32] qapi2texi: Fix for '@' not followed by \w character Markus Armbruster
2017-10-04 10:47 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 05/32] qapi2texi: Provide access to Texinfo markup Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 06/32] qapi2texi: Drop | example markup Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 07/32] qapi: Drop superfluous allow_optional=True Markus Armbruster
2017-10-04 10:52 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 08/32] qapi: Simplify check_name() parameters Markus Armbruster
2017-10-04 10:54 ` Marc-André Lureau
2017-10-04 10:54 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 09/32] qapi: check_type() parameter allow_optional is now unused, drop Markus Armbruster
2017-10-04 10:55 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 10/32] qapi: Don't run generators twice Markus Armbruster
2017-10-04 11:04 ` Marc-André Lureau
2017-10-02 15:25 ` Markus Armbruster [this message]
2017-10-04 11:07 ` [Qemu-devel] [RFC PATCH 11/32] qapi: Drop the options to generate only .c or .h Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 12/32] qapi: Use argparse to parse command line arguments Markus Armbruster
2017-10-04 11:13 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 13/32] qapi: Use argparse to open schema file Markus Armbruster
2017-10-04 11:18 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 14/32] qapi: Rework generated code for built-in types Markus Armbruster
2017-10-04 11:52 ` Marc-André Lureau
2017-10-05 4:24 ` Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 15/32] tests/qapi-schema: Improve simple union coverage Markus Armbruster
2017-10-04 12:02 ` Marc-André Lureau
2017-10-05 4:29 ` Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 16/32] qapi: Factor out _make_implicit_wrapper_type() Markus Armbruster
2017-10-04 12:00 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 17/32] qapi: Fix simple union lowering with multiple schemas Markus Armbruster
2017-10-04 12:04 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 18/32] docs/devel/qapi-code-gen.txt: Rewrite section on schema syntax Markus Armbruster
2017-10-04 11:59 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 19/32] qapi: Accept double-quoted strings Markus Armbruster
2017-10-04 11:58 ` Marc-André Lureau
2017-10-05 4:41 ` Markus Armbruster
2017-10-05 14:13 ` Marc-André Lureau
2017-10-06 5:29 ` Markus Armbruster
2017-10-05 15:16 ` Eric Blake
2017-10-06 5:27 ` Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 20/32] qapi: Frontend for defining command line options Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 21/32] qapi: Define QAPIOptionKind and QAPIOption automatically Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 22/32] qapi: New helper c_string() Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 23/32] qapi-options: Command line option backend Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 24/32] qapi-options: Generate help string Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 25/32] qapi-introspect: Include command line options information Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 26/32] qapi2texi: " Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 27/32] os-posix: Drop misleading comment Markus Armbruster
2017-10-04 12:10 ` Marc-André Lureau
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 28/32] vl: QAPIfy command line option definition Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 29/32] qapi/options: QAPIfy --echr argument type Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 30/32] qapi/options: QAPIfy --watchdog-action " Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 31/32] qapi/options: QAPIfy --blockdev " Markus Armbruster
2017-10-02 15:25 ` [Qemu-devel] [RFC PATCH 32/32] qapi/options: QAPIfy --add-fd " Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171002152552.27999-12-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).