summary refs log tree commit diff stats
path: root/scripts/qapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index c0728d73e1..62a415ccd9 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1536,6 +1536,18 @@ def gen_params(arg_type, extra):
         ret += sep + extra
     return ret
 
+
+def gen_err_check(err='err', label='out'):
+    if not err:
+        return ''
+    return mcgen('''
+    if (%(err)s) {
+        goto %(label)s;
+    }
+''',
+                 err=err, label=label)
+
+
 #
 # Common command line parsing
 #