From 4a8e0949580ef96a05bec7ac8a0c667cf1acc3df Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 25 Sep 2018 21:09:31 -0400 Subject: [PATCH] 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 --- qemu/scripts/qapi/common.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/qemu/scripts/qapi/common.py b/qemu/scripts/qapi/common.py index b6cdd0ab..2d72f6d6 100644 --- a/qemu/scripts/qapi/common.py +++ b/qemu/scripts/qapi/common.py @@ -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' #