aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi/common.py
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-04 12:31:02 +0400
committerMarkus Armbruster <armbru@redhat.com>2021-08-26 13:53:56 +0200
commit3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f (patch)
tree0dfacc884ce4a8aeb40e5a0e9ed57586b0a982e8 /scripts/qapi/common.py
parent5d83b9a130690f879d5f33e991beabe69cb88bc8 (diff)
qapi: add 'any' condition
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-8-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/common.py')
-rw-r--r--scripts/qapi/common.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 3d7272a702..63a2e502fb 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -207,7 +207,7 @@ def cgen_ifcond(ifcond: Union[str, Dict[str, Any]]) -> str:
return ifcond
oper, operands = next(iter(ifcond.items()))
- oper = {'all': '&&'}[oper]
+ oper = {'all': '&&', 'any': '||'}[oper]
operands = [cgen_ifcond(o) for o in operands]
return '(' + (') ' + oper + ' (').join(operands) + ')'
@@ -220,7 +220,7 @@ def docgen_ifcond(ifcond: Union[str, Dict[str, Any]]) -> str:
return ifcond
oper, operands = next(iter(ifcond.items()))
- oper = {'all': ' and '}[oper]
+ oper = {'all': ' and ', 'any': ' or '}[oper]
operands = [docgen_ifcond(o) for o in operands]
return '(' + oper.join(operands) + ')'