diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-29 20:06:08 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-29 20:06:08 +0000 |
| commit | 16884391c750d0c5e863f55ad7aaaa146fc5181e (patch) | |
| tree | 7909241a593eea7f9cafaea658e9b101a7682626 /scripts/qapi/expr.py | |
| parent | 1cfe28cdcabd10e31b0e05db8a2cfd9993f315e2 (diff) | |
| parent | e151941d1b691402f7914750e025209b7839a1c0 (diff) | |
| download | focaccia-qemu-16884391c750d0c5e863f55ad7aaaa146fc5181e.tar.gz focaccia-qemu-16884391c750d0c5e863f55ad7aaaa146fc5181e.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-10-29' into staging
QAPI patches for 2019-10-29 # gpg: Signature made Tue 29 Oct 2019 06:40:56 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2019-10-29: qapi: Check feature documentation against the schema qapi: Polish reporting of bogus member documentation qapi: Lift features into QAPISchemaEntity qapi: Fold normalize_enum() into check_enum() qapi: Fold normalize_features() into check_features() qapi: Fold normalize_if() into check_if() qapi: Eliminate .check_doc() overrides qapi: Simplify ._make_implicit_object_type() qapi: Fix doc comment checking for commands and events qapi: Clean up doc comment checking for implicit union base qapi: Fix enum doc comment checking qapi: Split .connect_doc(), .check_doc() off .check() qapi: De-duplicate entity documentation generation code qapi: Implement boxed event argument documentation qemu-doc: Belatedly document QMP command deprecation tests/qapi-schema: Fix feature documentation testing tests/qapi-schema: Cover alternate documentation comments tests/qapi-schema: Demonstrate command and event doc comment bugs tests/qapi-schema: Demonstrate feature and enum doc comment bugs Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/qapi/expr.py')
| -rw-r--r-- | scripts/qapi/expr.py | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 7c7394f835..d7a289eded 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -95,12 +95,6 @@ def check_flags(expr, info): info, "flag '%s' may only use true value" % key) -def normalize_if(expr): - ifcond = expr.get('if') - if isinstance(ifcond, str): - expr['if'] = [ifcond] - - def check_if(expr, info, source): def check_if_str(ifcond, info): @@ -126,6 +120,7 @@ def check_if(expr, info, source): check_if_str(elt, info) else: check_if_str(ifcond, info) + expr['if'] = [ifcond] def normalize_members(members): @@ -175,21 +170,16 @@ def check_type(value, info, source, raise QAPISemError(info, "%s uses reserved name" % key_source) check_keys(arg, info, key_source, ['type'], ['if']) check_if(arg, info, key_source) - normalize_if(arg) check_type(arg['type'], info, key_source, allow_array=True) -def normalize_features(features): - if isinstance(features, list): - features[:] = [f if isinstance(f, dict) else {'name': f} - for f in features] - - def check_features(features, info): if features is None: return if not isinstance(features, list): raise QAPISemError(info, "'features' must be an array") + features[:] = [f if isinstance(f, dict) else {'name': f} + for f in features] for f in features: source = "'features' member" assert isinstance(f, dict) @@ -198,13 +188,6 @@ def check_features(features, info): source = "%s '%s'" % (source, f['name']) check_name_str(f['name'], info, source) check_if(f, info, source) - normalize_if(f) - - -def normalize_enum(expr): - if isinstance(expr['data'], list): - expr['data'] = [m if isinstance(m, dict) else {'name': m} - for m in expr['data']] def check_enum(expr, info): @@ -219,6 +202,8 @@ def check_enum(expr, info): permit_upper = name in info.pragma.name_case_whitelist + members[:] = [m if isinstance(m, dict) else {'name': m} + for m in members] for member in members: source = "'data' member" check_keys(member, info, source, ['name'], ['if']) @@ -227,7 +212,6 @@ def check_enum(expr, info): check_name_str(member['name'], info, source, enum_member=True, permit_upper=permit_upper) check_if(member, info, source) - normalize_if(member) def check_struct(expr, info): @@ -259,7 +243,6 @@ def check_union(expr, info): check_name_str(key, info, source) check_keys(value, info, source, ['type'], ['if']) check_if(value, info, source) - normalize_if(value) check_type(value['type'], info, source, allow_array=not base) @@ -273,7 +256,6 @@ def check_alternate(expr, info): check_name_str(key, info, source) check_keys(value, info, source, ['type'], ['if']) check_if(value, info, source) - normalize_if(value) check_type(value['type'], info, source) @@ -339,7 +321,6 @@ def check_exprs(exprs): if meta == 'enum': check_keys(expr, info, meta, ['enum', 'data'], ['if', 'prefix']) - normalize_enum(expr) check_enum(expr, info) elif meta == 'union': check_keys(expr, info, meta, @@ -357,7 +338,6 @@ def check_exprs(exprs): check_keys(expr, info, meta, ['struct', 'data'], ['base', 'if', 'features']) normalize_members(expr['data']) - normalize_features(expr.get('features')) check_struct(expr, info) elif meta == 'command': check_keys(expr, info, meta, @@ -366,7 +346,6 @@ def check_exprs(exprs): 'gen', 'success-response', 'allow-oob', 'allow-preconfig']) normalize_members(expr.get('data')) - normalize_features(expr.get('features')) check_command(expr, info) elif meta == 'event': check_keys(expr, info, meta, @@ -376,7 +355,6 @@ def check_exprs(exprs): else: assert False, 'unexpected meta type' - normalize_if(expr) check_if(expr, info, meta) check_flags(expr, info) |