qapi: New special feature flag "deprecated"
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> Message-Id: <20200317115459.31821-26-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Doc typo fixed]
This commit is contained in:
parent
4a8837389e
commit
f965e8fea6
@ -683,6 +683,12 @@ Intended use is to have each feature string signal that this build of
|
|||||||
QEMU shows a certain behaviour.
|
QEMU shows a certain behaviour.
|
||||||
|
|
||||||
|
|
||||||
|
==== Special features ====
|
||||||
|
|
||||||
|
Feature "deprecated" marks a command, event, or struct member as
|
||||||
|
deprecated. It is not supported elsewhere so far.
|
||||||
|
|
||||||
|
|
||||||
=== Naming rules and reserved names ===
|
=== Naming rules and reserved names ===
|
||||||
|
|
||||||
All names must begin with a letter, and contain only ASCII letters,
|
All names must begin with a letter, and contain only ASCII letters,
|
||||||
|
@ -193,6 +193,12 @@ class QAPISchemaType(QAPISchemaEntity):
|
|||||||
return None
|
return None
|
||||||
return self.name
|
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):
|
def describe(self):
|
||||||
assert self.meta
|
assert self.meta
|
||||||
return "%s type '%s'" % (self.meta, self.name)
|
return "%s type '%s'" % (self.meta, self.name)
|
||||||
|
@ -242,6 +242,7 @@ qapi-schema += event-case.json
|
|||||||
qapi-schema += event-member-invalid-dict.json
|
qapi-schema += event-member-invalid-dict.json
|
||||||
qapi-schema += event-nest-struct.json
|
qapi-schema += event-nest-struct.json
|
||||||
qapi-schema += features-bad-type.json
|
qapi-schema += features-bad-type.json
|
||||||
|
qapi-schema += features-deprecated-type.json
|
||||||
qapi-schema += features-duplicate-name.json
|
qapi-schema += features-duplicate-name.json
|
||||||
qapi-schema += features-if-invalid.json
|
qapi-schema += features-if-invalid.json
|
||||||
qapi-schema += features-missing-name.json
|
qapi-schema += features-missing-name.json
|
||||||
|
2
tests/qapi-schema/features-deprecated-type.err
Normal file
2
tests/qapi-schema/features-deprecated-type.err
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
features-deprecated-type.json: In struct 'S':
|
||||||
|
features-deprecated-type.json:2: feature 'deprecated' is not supported for types
|
3
tests/qapi-schema/features-deprecated-type.json
Normal file
3
tests/qapi-schema/features-deprecated-type.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Feature 'deprecated' is not supported for types
|
||||||
|
{ 'struct': 'S', 'data': {},
|
||||||
|
'features': [ 'deprecated' ] }
|
0
tests/qapi-schema/features-deprecated-type.out
Normal file
0
tests/qapi-schema/features-deprecated-type.out
Normal file
@ -258,7 +258,7 @@
|
|||||||
'data': { 'foo': 'int' },
|
'data': { 'foo': 'int' },
|
||||||
'features': [] }
|
'features': [] }
|
||||||
{ 'struct': 'FeatureStruct1',
|
{ 'struct': 'FeatureStruct1',
|
||||||
'data': { 'foo': { 'type': 'int', 'features': [ 'member-feature1' ] } },
|
'data': { 'foo': { 'type': 'int', 'features': [ 'deprecated' ] } },
|
||||||
'features': [ 'feature1' ] }
|
'features': [ 'feature1' ] }
|
||||||
{ 'struct': 'FeatureStruct2',
|
{ 'struct': 'FeatureStruct2',
|
||||||
'data': { 'foo': 'int' },
|
'data': { 'foo': 'int' },
|
||||||
@ -308,7 +308,7 @@
|
|||||||
'features': [] }
|
'features': [] }
|
||||||
|
|
||||||
{ 'command': 'test-command-features1',
|
{ 'command': 'test-command-features1',
|
||||||
'features': [ 'feature1' ] }
|
'features': [ 'deprecated' ] }
|
||||||
{ 'command': 'test-command-features3',
|
{ 'command': 'test-command-features3',
|
||||||
'features': [ 'feature1', 'feature2' ] }
|
'features': [ 'feature1', 'feature2' ] }
|
||||||
|
|
||||||
@ -322,4 +322,4 @@
|
|||||||
'defined(TEST_IF_COND_2)'] } ] }
|
'defined(TEST_IF_COND_2)'] } ] }
|
||||||
|
|
||||||
{ 'event': 'TEST-EVENT-FEATURES1',
|
{ 'event': 'TEST-EVENT-FEATURES1',
|
||||||
'features': [ 'feature1' ] }
|
'features': [ 'deprecated' ] }
|
||||||
|
@ -359,7 +359,7 @@ object FeatureStruct0
|
|||||||
member foo: int optional=False
|
member foo: int optional=False
|
||||||
object FeatureStruct1
|
object FeatureStruct1
|
||||||
member foo: int optional=False
|
member foo: int optional=False
|
||||||
feature member-feature1
|
feature deprecated
|
||||||
feature feature1
|
feature feature1
|
||||||
object FeatureStruct2
|
object FeatureStruct2
|
||||||
member foo: int optional=False
|
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
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
||||||
command test-command-features1 None -> None
|
command test-command-features1 None -> None
|
||||||
gen=True success_response=True boxed=False oob=False preconfig=False
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
||||||
feature feature1
|
feature deprecated
|
||||||
command test-command-features3 None -> None
|
command test-command-features3 None -> None
|
||||||
gen=True success_response=True boxed=False oob=False preconfig=False
|
gen=True success_response=True boxed=False oob=False preconfig=False
|
||||||
feature feature1
|
feature feature1
|
||||||
@ -440,7 +440,7 @@ command test-command-cond-features3 None -> None
|
|||||||
if ['defined(TEST_IF_COND_1)', 'defined(TEST_IF_COND_2)']
|
if ['defined(TEST_IF_COND_1)', 'defined(TEST_IF_COND_2)']
|
||||||
event TEST-EVENT-FEATURES1 None
|
event TEST-EVENT-FEATURES1 None
|
||||||
boxed=False
|
boxed=False
|
||||||
feature feature1
|
feature deprecated
|
||||||
module include/sub-module.json
|
module include/sub-module.json
|
||||||
include sub-sub-module.json
|
include sub-sub-module.json
|
||||||
object SecondArrayRef
|
object SecondArrayRef
|
||||||
|
Loading…
Reference in New Issue
Block a user