mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qapi: More rigorous checking for type safety bypass
Now that we have a way to validate every type, we can also be stricter about enforcing that callers that want to bypass type safety in generated code. Prior to this patch, it didn't matter what value was associated with the key 'gen', but it looked odd that 'gen':'yes' could result in bypassing the generated code. These changes also enforce the changes made earlier in the series for documentation and consolidation of using '**' as the wildcard type, as well as 'gen':false as the canonical spelling for requesting type bypass. Note that 'gen':false is a one-way switch away from the default; we do not support 'gen':true (similar for 'success-response'). In practice, this doesn't matter. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
10d4d997f8
commit
2cbf09925a
9 changed files with 23 additions and 15 deletions
|
@ -0,0 +1 @@
|
|||
tests/qapi-schema/type-bypass-bad-gen.json:2: 'gen' of command 'foo' should only use false value
|
|
@ -1 +1 @@
|
|||
0
|
||||
1
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# FIXME: 'gen' should only appear with value false
|
||||
# 'gen' should only appear with value false
|
||||
{ 'command': 'foo', 'gen': 'whatever' }
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[OrderedDict([('command', 'foo'), ('gen', 'whatever')])]
|
||||
[]
|
||||
[]
|
|
@ -0,0 +1 @@
|
|||
tests/qapi-schema/type-bypass-no-gen.json:2: Member 'arg' of 'data' for command 'unsafe' uses '**' but did not request 'gen':false
|
|
@ -1 +1 @@
|
|||
0
|
||||
1
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# FIXME: type bypass should only work with 'gen':false
|
||||
# type bypass only works with 'gen':false
|
||||
{ 'command': 'unsafe', 'data': { 'arg': '**' }, 'returns': '**' }
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[OrderedDict([('command', 'unsafe'), ('data', OrderedDict([('arg', '**')])), ('returns', '**')])]
|
||||
[]
|
||||
[]
|
Loading…
Add table
Add a link
Reference in a new issue