]> Git Repo - qemu.git/commitdiff
qapi: Fix build_params() for empty parameter list
authorMarkus Armbruster <[email protected]>
Wed, 15 Aug 2018 13:37:36 +0000 (21:37 +0800)
committerMarkus Armbruster <[email protected]>
Tue, 28 Aug 2018 16:21:38 +0000 (18:21 +0200)
build_params() returns '' instead of 'void' when there are no
parameters.  Can't happen now, but the next commit will change that.

Signed-off-by: Markus Armbruster <[email protected]>
[peterx: compose the patch from email replies]
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180815133747[email protected]>

scripts/qapi/common.py

index 02c5c6767ade9c09de5abb81a98f7f0402c2e0f8..3b0d4bf9c0f7c4ca29aa92dedf6230dc6862f195 100644 (file)
@@ -2070,16 +2070,14 @@ extern const QEnumLookup %(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
@@ -2090,7 +2088,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'
 
 
 #
This page took 0.028502 seconds and 4 git commands to generate.