diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-01 16:41:41 +0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-07-12 17:51:54 +0200 |
commit | 086ee7a6200fa5ad795b12110b5b3d5a93dcac3e (patch) | |
tree | 0de1897c3b5fa65572d1d7972b7ab8477bbc16e6 /scripts/qapi-event.py | |
parent | 8a4613a0ab4b6e9271e64aaa88f588ed1b749eb4 (diff) |
scripts: use build_ prefix for string not piped through cgen()
The gen_ prefix is awkward. Generated C should go through cgen()
exactly once (see commit 1f9a7a1). The common way to get this wrong is
passing a foo=gen_foo() keyword argument to mcgen(). I'd like us to
adopt a naming convention where gen_ means "something that's been piped
through cgen(), and thus must not be passed to cgen() or mcgen()".
Requires renaming gen_params(), gen_marshal_proto() and
gen_event_send_proto().
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170601124143.10915-1-marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi-event.py')
-rw-r--r-- | scripts/qapi-event.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index 0485e39145..bcbef1035f 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -14,10 +14,10 @@ from qapi import * -def gen_event_send_proto(name, arg_type, boxed): +def build_event_send_proto(name, arg_type, boxed): return 'void qapi_event_send_%(c_name)s(%(param)s)' % { 'c_name': c_name(name.lower()), - 'param': gen_params(arg_type, boxed, 'Error **errp')} + 'param': build_params(arg_type, boxed, 'Error **errp')} def gen_event_send_decl(name, arg_type, boxed): @@ -25,10 +25,10 @@ def gen_event_send_decl(name, arg_type, boxed): %(proto)s; ''', - proto=gen_event_send_proto(name, arg_type, boxed)) + proto=build_event_send_proto(name, arg_type, boxed)) -# Declare and initialize an object 'qapi' using parameters from gen_params() +# Declare and initialize an object 'qapi' using parameters from build_params() def gen_param_var(typ): assert not typ.variants ret = mcgen(''' @@ -42,7 +42,7 @@ def gen_param_var(typ): if memb.optional: ret += 'has_' + c_name(memb.name) + sep if memb.type.name == 'str': - # Cast away const added in gen_params() + # Cast away const added in build_params() ret += '(char *)' ret += c_name(memb.name) ret += mcgen(''' @@ -72,7 +72,7 @@ def gen_event_send(name, arg_type, boxed): Error *err = NULL; QMPEventFuncEmit emit; ''', - proto=gen_event_send_proto(name, arg_type, boxed)) + proto=build_event_send_proto(name, arg_type, boxed)) if arg_type and not arg_type.is_empty(): ret += mcgen(''' |