qapi: Fix build_params() for empty parameter list

build_params() returns '' instead of 'void' when there are no
parameters. Can't happen now, but the next commit will change that.

Backports commit bdd2d42b890b3a908fa3fbdc9661541e1b57eb15 from qemu
This commit is contained in:
Markus Armbruster 2018-09-25 21:09:31 -04:00 committed by Lioncash
parent 81f8a1be80
commit 4a8e094958
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -2078,16 +2078,14 @@ extern const char *const %(c_name)s_lookup[];
return ret
def build_params(arg_type, boxed, extra):
if not arg_type:
assert not boxed
return extra
def build_params(arg_type, boxed, extra=None):
ret = ''
sep = ''
if boxed:
assert arg_type
ret += '%s arg' % arg_type.c_param_type()
sep = ', '
else:
elif arg_type:
assert not arg_type.variants
for memb in arg_type.members:
ret += sep
@ -2098,7 +2096,7 @@ def build_params(arg_type, boxed, extra):
c_name(memb.name))
if extra:
ret += sep + extra
return ret
return ret if ret else 'void'
#