summary refs log tree commit diff stats
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-09-14 17:34:58 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-09-24 14:07:23 +0200
commitc2c7065e1752a3be1b437d1ea359cde35d28ee3b (patch)
tree309fd28ba39f32c26ebaaf9ca0b06852a5c67f2d /scripts/qapi
parent887a2069f76fa99b9755467126dd171a9bad34a3 (diff)
downloadfocaccia-qemu-c2c7065e1752a3be1b437d1ea359cde35d28ee3b.tar.gz
focaccia-qemu-c2c7065e1752a3be1b437d1ea359cde35d28ee3b.zip
qapi: Reject blank 'if' conditions in addition to empty ones
"'if': 'COND'" generates "#if COND".  We reject empty COND because it
won't compile.  Blank COND won't compile any better, so reject that,
too.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190914153506.2151-12-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/common.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index a58e904978..2b46164854 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -742,8 +742,9 @@ def check_if(expr, info):
         if not isinstance(ifcond, str):
             raise QAPISemError(
                 info, "'if' condition must be a string or a list of strings")
-        if ifcond == '':
-            raise QAPISemError(info, "'if' condition '' makes no sense")
+        if ifcond.strip() == '':
+            raise QAPISemError(info, "'if' condition '%s' makes no sense"
+                               % ifcond)
 
     ifcond = expr.get('if')
     if ifcond is None: