aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-21 10:49:40 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-21 10:49:40 -0700
commit378f973a6ce89de16496bc6007f4dffa2f881dbc (patch)
treed7a32ed7bf0094b9a620cc127a88977925de2623 /scripts
parent28298069afff3eb696e4995e63b2579b27adf378 (diff)
parentde7371bc7c39ccacb963acb5129b261087967070 (diff)
Merge tag 'pull-qapi-2022-04-21' of git://repo.or.cz/qemu/armbru into staging
QAPI patches patches for 2022-04-21 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmJhZgISHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTuZQP/iesk/r4ytyk+q+ksNCQHTZl4B4uZcbI # TgbA1dwbwkKOfNaqByKZzXvbymL9Y4RpZavZ0i1qa3hK5orKHThLK4omRaFD+SPp # sH53TeTgkG/UNUQk00dim1BzuWJefqFo1rYSqvTzaXVPyx1Q9Gk9193q5zDTlMJs # w6UKD+q+Yxne9aoi1IH2NzzEKElHz7MMFeBDsnxDbkedzBxY1Ka05IOI2ucXhJ7X # mYTZxHsrjncW4qJNkf57u9y4faNDIBeT3vkFqBaIeTXSSqm+xO1rkLanGOLQKtIM # zD6JDMcqsIkZttEy0QCOrjKvMueWaOTZsS0sbdCC+JpBAbyVeS83kmRyYwEhyGre # FJzf81zcEH6FtnDYudWWUT7hKV6sHWbw+4ho5WTkCYnr/Cfqr3TyDbSW+f/eIxUK # vaujP/8MTypS4p0mx4QfM2/eO05oZHwEaslOn0gkg7siAJWuC7KUkkWSwz6ZNZCp # qj/+jtDRGhvB4bGFusciqwtbnLNtVPX2meUuVxK74lmKa00+zXraNFfvGIxfzzC0 # pJ6weJj2jMLo5OEsZ2xWfNqhDigFQYxbGR8X3N2hg5GZTx1k5WXx7mRz3GlAwd8Q # /4hcTBXKTFxDNxXqzL2eHBtaruKHjnHoVo2eAodyF+9FqErInjr/wisVm6I+R8NR # Z94UBs8lvMIC # =a3AD # -----END PGP SIGNATURE----- # gpg: Signature made Thu 21 Apr 2022 07:11:14 AM PDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [undefined] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-qapi-2022-04-21' of git://repo.or.cz/qemu/armbru: qapi: Fix version of cpu0-id field qapi: Fix typo qapi: Fix documentation for query-xen-replication-status docs: qapi: Remove outdated reference to simple unions qapi-schema: test: add a unit test for parsing array alternates qapi-schema: test: add a qapi-schema-test for array alternates qapi-schema: support alternates with array type Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/expr.py2
-rw-r--r--scripts/qapi/schema.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 3cb389e875..48578e1698 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -554,7 +554,7 @@ def check_alternate(expr: _JSONObject, info: QAPISourceInfo) -> None:
check_name_lower(key, info, source)
check_keys(value, info, source, ['type'], ['if'])
check_if(value, info, source)
- check_type(value['type'], info, source)
+ check_type(value['type'], info, source, allow_array=True)
def check_command(expr: _JSONObject, info: QAPISourceInfo) -> None:
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index b7b3fc0ce4..3728340c37 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -243,6 +243,7 @@ class QAPISchemaType(QAPISchemaEntity):
'number': 'QTYPE_QNUM',
'int': 'QTYPE_QNUM',
'boolean': 'QTYPE_QBOOL',
+ 'array': 'QTYPE_QLIST',
'object': 'QTYPE_QDICT'
}
return json2qtype.get(self.json_type())
@@ -1069,6 +1070,9 @@ class QAPISchema:
None))
def _make_variant(self, case, typ, ifcond, info):
+ if isinstance(typ, list):
+ assert len(typ) == 1
+ typ = self._make_array_type(typ[0], info)
return QAPISchemaVariant(case, info, typ, ifcond)
def _def_union_type(self, expr, info, doc):