[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 13/19] qapi: New special feature flag "deprecated"
From: |
Markus Armbruster |
Subject: |
[RFC PATCH 13/19] qapi: New special feature flag "deprecated" |
Date: |
Thu, 24 Oct 2019 14:34:52 +0200 |
Unlike regular feature flags, the new special feature flag
"deprecated" is recognized by the QAPI generator. For now, it's only
permitted with commands and events. It will be put to use shortly.
Signed-off-by: Markus Armbruster <address@hidden>
---
docs/devel/qapi-code-gen.txt | 6 ++++++
scripts/qapi/schema.py | 6 ++++++
tests/Makefile.include | 1 +
tests/qapi-schema/features-deprecated-type.err | 2 ++
tests/qapi-schema/features-deprecated-type.json | 3 +++
tests/qapi-schema/features-deprecated-type.out | 0
tests/qapi-schema/qapi-schema-test.json | 4 ++--
tests/qapi-schema/qapi-schema-test.out | 4 ++--
8 files changed, 22 insertions(+), 4 deletions(-)
create mode 100644 tests/qapi-schema/features-deprecated-type.err
create mode 100644 tests/qapi-schema/features-deprecated-type.json
create mode 100644 tests/qapi-schema/features-deprecated-type.out
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index eaeedc7bd3..e6ef93544e 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -665,6 +665,12 @@ Example:
'features': [ 'allow-negative-numbers' ] }
+==== Special features ====
+
+Feature "deprecated" makes a command or event as deprecated. It is
+not supported elsewhere so far.
+
+
=== Naming rules and reserved names ===
All names must begin with a letter, and contain only ASCII letters,
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 639140fceb..840d119c6d 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -179,6 +179,12 @@ class QAPISchemaType(QAPISchemaEntity):
return None
return self.name
+ def check(self, schema):
+ QAPISchemaEntity.check(self, schema)
+ if 'deprecated' in [f.name for f in self.features]:
+ raise QAPISemError(
+ self.info, "feature 'deprecated' is not supported for types")
+
def describe(self):
assert self.meta
return "%s type '%s'" % (self.meta, self.name)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index ea35cd54cc..9da831b882 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -388,6 +388,7 @@ qapi-schema += event-case.json
qapi-schema += event-member-invalid-dict.json
qapi-schema += event-nest-struct.json
qapi-schema += features-bad-type.json
+qapi-schema += features-deprecated-type.json
qapi-schema += features-duplicate-name.json
qapi-schema += features-if-invalid.json
qapi-schema += features-missing-name.json
diff --git a/tests/qapi-schema/features-deprecated-type.err
b/tests/qapi-schema/features-deprecated-type.err
new file mode 100644
index 0000000000..af4ffe20aa
--- /dev/null
+++ b/tests/qapi-schema/features-deprecated-type.err
@@ -0,0 +1,2 @@
+features-deprecated-type.json: In struct 'S':
+features-deprecated-type.json:2: feature 'deprecated' is not supported for
types
diff --git a/tests/qapi-schema/features-deprecated-type.json
b/tests/qapi-schema/features-deprecated-type.json
new file mode 100644
index 0000000000..4b5bf5b86e
--- /dev/null
+++ b/tests/qapi-schema/features-deprecated-type.json
@@ -0,0 +1,3 @@
+# Feature 'deprecated' is not supported for types
+{ 'struct': 'S', 'data': {},
+ 'features': [ 'deprecated' ] }
diff --git a/tests/qapi-schema/features-deprecated-type.out
b/tests/qapi-schema/features-deprecated-type.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/qapi-schema-test.json
b/tests/qapi-schema/qapi-schema-test.json
index fa4f3a15da..6862d8ba2c 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -308,7 +308,7 @@
'features': [] }
{ 'command': 'test-command-features1',
- 'features': [ 'feature1' ] }
+ 'features': [ 'deprecated' ] }
{ 'command': 'test-command-features3',
'features': [ 'feature1', 'feature2' ] }
@@ -322,4 +322,4 @@
'defined(TEST_IF_COND_2)'] } ] }
{ 'event': 'TEST-EVENT-FEATURES1',
- 'features': [ 'feature1' ] }
+ 'features': [ 'deprecated' ] }
diff --git a/tests/qapi-schema/qapi-schema-test.out
b/tests/qapi-schema/qapi-schema-test.out
index 1ece836d9b..494d4c25c4 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -432,7 +432,7 @@ command test-features0 q_obj_test-features0-arg -> None
gen=True success_response=True boxed=False oob=False preconfig=False
command test-command-features1 None -> None
gen=True success_response=True boxed=False oob=False preconfig=False
- feature feature1
+ feature deprecated
command test-command-features3 None -> None
gen=True success_response=True boxed=False oob=False preconfig=False
feature feature1
@@ -453,4 +453,4 @@ command test-command-cond-features3 None -> None
if ['defined(TEST_IF_COND_1)', 'defined(TEST_IF_COND_2)']
event TEST-EVENT-FEATURES1 None
boxed=False
- feature feature1
+ feature deprecated
--
2.21.0
- [RFC PATCH 00/19] Configurable policy for handling deprecated interfaces, Markus Armbruster, 2019/10/24
- [RFC PATCH 02/19] tests/test-qmp-cmds: Check responses more thoroughly, Markus Armbruster, 2019/10/24
- [RFC PATCH 03/19] tests/test-qmp-cmds: Simplify test data setup, Markus Armbruster, 2019/10/24
- [RFC PATCH 04/19] tests/test-qmp-event: Simplify test data setup, Markus Armbruster, 2019/10/24
- [RFC PATCH 01/19] tests/test-qmp-cmds: Factor out qmp_dispatch() test helpers, Markus Armbruster, 2019/10/24
- [RFC PATCH 12/19] qapi: Replace qmp_dispatch()'s TODO comment by an explanation, Markus Armbruster, 2019/10/24
- [RFC PATCH 15/19] qapi: Mark deprecated QMP commands with feature 'deprecated', Markus Armbruster, 2019/10/24
- [RFC PATCH 18/19] qapi: Include a warning in the response to a deprecated command, Markus Armbruster, 2019/10/24
- [RFC PATCH 19/19] qapi: Implement -compat deprecated-output=hide for events, Markus Armbruster, 2019/10/24
- [RFC PATCH 17/19] qapi: Implement -compat deprecated-input=crash for commands, Markus Armbruster, 2019/10/24
- [RFC PATCH 13/19] qapi: New special feature flag "deprecated",
Markus Armbruster <=
- [RFC PATCH 05/19] tests/test-qmp-event: Use qobject_is_equal(), Markus Armbruster, 2019/10/24
- [RFC PATCH 14/19] qemu-options: New -compat to set policy for "funny" interfaces, Markus Armbruster, 2019/10/24
- [RFC PATCH 09/19] qapi: Inline do_qmp_dispatch() into qmp_dispatch(), Markus Armbruster, 2019/10/24
- [RFC PATCH 11/19] qapi: Simplify how qmp_dispatch() gets the request ID, Markus Armbruster, 2019/10/24
- [RFC PATCH 16/19] qapi: Implement -compat deprecated-input=reject for commands, Markus Armbruster, 2019/10/24
- [RFC PATCH 06/19] tests/test-qmp-event: Check event is actually emitted, Markus Armbruster, 2019/10/24
- [RFC PATCH 10/19] qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP, Markus Armbruster, 2019/10/24
- [RFC PATCH 08/19] qapi: Consistently put @features parameter right after @ifcond, Markus Armbruster, 2019/10/24
- [RFC PATCH 07/19] qapi: Add feature flags to remaining definitions, Markus Armbruster, 2019/10/24