All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, berrange@redhat.com, mdroth@linux.vnet.ibm.com
Subject: [PATCH v2 25/30] qapi: New special feature flag "deprecated"
Date: Tue,  3 Mar 2020 17:35:00 +0100	[thread overview]
Message-ID: <20200303163505.32041-26-armbru@redhat.com> (raw)
In-Reply-To: <20200303163505.32041-1-armbru@redhat.com>

Unlike regular feature flags, the new special feature flag
"deprecated" is recognized by the QAPI generator.  For now, it's only
permitted with commands, events, and struct members.  It will be put
to use shortly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 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         | 6 +++---
 tests/qapi-schema/qapi-schema-test.out          | 6 +++---
 8 files changed, 24 insertions(+), 6 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 a1ef1cfd61..823adbabda 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -683,6 +683,12 @@ Intended use is to have each feature string signal that this build of
 QEMU shows a certain behaviour.
 
 
+==== Special features ====
+
+Feature "deprecated" makes a command, event, or struct member 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 2fb845303b..b303a2631d 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -193,6 +193,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 edcbd475aa..bc74970cda 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -242,6 +242,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 f576c337af..6b1f05afa7 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -258,7 +258,7 @@
   'data': { 'foo': 'int' },
   'features': [] }
 { 'struct': 'FeatureStruct1',
-  'data': { 'foo': { 'type': 'int', 'features': [ 'member-feature1' ] } },
+  'data': { 'foo': { 'type': 'int', 'features': [ 'deprecated' ] } },
   'features': [ 'feature1' ] }
 { 'struct': 'FeatureStruct2',
   'data': { 'foo': 'int' },
@@ -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 cd863ae966..891b4101e0 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -359,7 +359,7 @@ object FeatureStruct0
     member foo: int optional=False
 object FeatureStruct1
     member foo: int optional=False
-        feature member-feature1
+        feature deprecated
     feature feature1
 object FeatureStruct2
     member foo: int optional=False
@@ -419,7 +419,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
@@ -440,7 +440,7 @@ 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
 module include/sub-module.json
 include sub-sub-module.json
 object SecondArrayRef
-- 
2.21.1



  parent reply	other threads:[~2020-03-03 16:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 16:34 [PATCH v2 00/30] Configurable policy for handling deprecated interfaces Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 01/30] qemu-doc: Belatedly document QMP command arg & result deprecation Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 02/30] qapi: Belatedly update doc comment for @wait deprecation Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 03/30] docs/devel/qapi-code-gen: Clarify allow-oob introspection Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 04/30] docs/devel/qapi-code-gen: Document 'features' introspection Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 05/30] tests/test-qmp-cmds: Factor out qmp_dispatch() test helpers Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 06/30] tests/test-qmp-cmds: Check responses more thoroughly Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 07/30] tests/test-qmp-cmds: Simplify test data setup Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 08/30] tests/test-qmp-event: " Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 09/30] tests/test-qmp-event: Use qobject_is_equal() Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 10/30] tests/test-qmp-event: Check event is actually emitted Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 11/30] qapi/schema: Clean up around QAPISchemaEntity.connect_doc() Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 12/30] qapi: Add feature flags to remaining definitions Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 13/30] qapi: Consistently put @features parameter right after @ifcond Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 14/30] qapi/introspect: Rename *qlit* to reduce confusion Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 15/30] qapi/introspect: Factor out _make_tree() Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 16/30] qapi/schema: Change _make_features() to a take feature list Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 17/30] qapi/schema: Reorder classes so related ones are together Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 18/30] qapi/schema: Rename QAPISchemaObjectType{Variant, Variants} Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 19/30] qapi/schema: Call QAPIDoc.connect_member() in just one place Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 20/30] qapi: Add feature flags to struct members Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 21/30] qapi: Inline do_qmp_dispatch() into qmp_dispatch() Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 22/30] qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 23/30] qapi: Simplify how qmp_dispatch() gets the request ID Markus Armbruster
2020-03-03 16:34 ` [PATCH v2 24/30] qapi: Replace qmp_dispatch()'s TODO comment by an explanation Markus Armbruster
2020-03-03 16:35 ` Markus Armbruster [this message]
2020-03-03 16:35 ` [PATCH v2 26/30] qapi: Mark deprecated QMP parts with feature 'deprecated' Markus Armbruster
2020-03-03 16:35 ` [PATCH v2 27/30] qemu-options: New -compat to set policy for deprecated interfaces Markus Armbruster
2020-03-03 16:35 ` [PATCH v2 28/30] qapi: Implement -compat deprecated-output=hide Markus Armbruster
2020-03-03 16:35 ` [PATCH v2 29/30] qapi: Implement -compat deprecated-input=reject Markus Armbruster
2020-03-03 16:35 ` [PATCH v2 30/30] qapi: New -compat deprecated-input=crash Markus Armbruster
2020-03-03 17:21 ` [PATCH v2 00/30] Configurable policy for handling deprecated interfaces Peter Maydell
2020-03-04  8:18   ` Markus Armbruster
2020-03-04  9:01     ` Peter Maydell
2020-03-04  9:27       ` Markus Armbruster
2020-03-04 11:55 ` Peter Krempa
2020-03-04 13:43 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200303163505.32041-26-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.