From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH RFC v5 29/32] qapi: Pseudo-type '**' is now unused, drop it
Date: Mon, 7 Sep 2015 12:16:40 +0200 [thread overview]
Message-ID: <1441621003-2434-30-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1441621003-2434-1-git-send-email-armbru@redhat.com>
'gen': false needs to stay for now, because netdev_add is still using
it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
docs/qapi-code-gen.txt | 18 ++++++------------
scripts/qapi.py | 20 ++++----------------
tests/Makefile | 2 +-
tests/qapi-schema/type-bypass-no-gen.err | 1 -
tests/qapi-schema/type-bypass-no-gen.exit | 1 -
tests/qapi-schema/type-bypass-no-gen.json | 2 --
tests/qapi-schema/type-bypass-no-gen.out | 0
tests/qapi-schema/type-bypass.err | 0
tests/qapi-schema/type-bypass.exit | 1 -
tests/qapi-schema/type-bypass.json | 2 --
tests/qapi-schema/type-bypass.out | 4 ----
11 files changed, 11 insertions(+), 40 deletions(-)
delete mode 100644 tests/qapi-schema/type-bypass-no-gen.err
delete mode 100644 tests/qapi-schema/type-bypass-no-gen.exit
delete mode 100644 tests/qapi-schema/type-bypass-no-gen.json
delete mode 100644 tests/qapi-schema/type-bypass-no-gen.out
delete mode 100644 tests/qapi-schema/type-bypass.err
delete mode 100644 tests/qapi-schema/type-bypass.exit
delete mode 100644 tests/qapi-schema/type-bypass.json
delete mode 100644 tests/qapi-schema/type-bypass.out
diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt
index a5fccd4..ce32d74 100644
--- a/docs/qapi-code-gen.txt
+++ b/docs/qapi-code-gen.txt
@@ -111,10 +111,7 @@ and field names within a type, should be all lower case with words
separated by a hyphen. However, some existing older commands and
complex types use underscore; when extending such expressions,
consistency is preferred over blindly avoiding underscore. Event
-names should be ALL_CAPS with words separated by underscore. The
-special string '**' appears for some commands that manually perform
-their own type checking rather than relying on the type-safe code
-produced by the qapi code generators.
+names should be ALL_CAPS with words separated by underscore.
Any name (command, event, type, field, or enum value) beginning with
"x-" is marked experimental, and may be withdrawn or changed
@@ -453,14 +450,11 @@ which would validate this Client JSON Protocol transaction:
<= { "return": [ { "value": "one" }, { } ] }
In rare cases, QAPI cannot express a type-safe representation of a
-corresponding Client JSON Protocol command. In these cases, if the
-command expression includes the key 'gen' with boolean value false,
-then the 'data' or 'returns' member that intends to bypass generated
-type-safety and do its own manual validation should use an inline
-dictionary definition, with a value of '**' rather than a valid type
-name for the keys that the generated code will not validate. Please
-try to avoid adding new commands that rely on this, and instead use
-type-safe unions. For an example of bypass usage:
+corresponding Client JSON Protocol command. You then have to suppress
+generation of a marshalling function by including a key 'gen' with
+boolean value false, and instead write your own function. Please try
+to avoid adding new commands that rely on this, and instead use
+type-safe unions. For an example of this usage:
{ 'command': 'netdev_add',
'data': {'type': 'str', 'id': 'str'},
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 415f782..60da124 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -428,15 +428,12 @@ def is_enum(name):
def check_type(expr_info, source, value, allow_array = False,
allow_dict = False, allow_optional = False,
- allow_star = False, allow_metas = []):
+ allow_metas = []):
global all_names
if value is None:
return
- if allow_star and value == '**':
- return
-
# Check if array type for value is okay
if isinstance(value, list):
if not allow_array:
@@ -450,10 +447,6 @@ def check_type(expr_info, source, value, allow_array = False,
# Check if type name for value is okay
if isinstance(value, str):
- if value == '**':
- raise QAPIExprError(expr_info,
- "%s uses '**' but did not request 'gen':false"
- % source)
if not value in all_names:
raise QAPIExprError(expr_info,
"%s uses unknown type '%s'"
@@ -479,7 +472,7 @@ def check_type(expr_info, source, value, allow_array = False,
# Todo: allow dictionaries to represent default values of
# an optional argument.
check_type(expr_info, "Member '%s' of %s" % (key, source), arg,
- allow_array=True, allow_star=allow_star,
+ allow_array=True,
allow_metas=['built-in', 'union', 'alternate', 'struct',
'enum'])
@@ -499,18 +492,16 @@ def check_member_clash(expr_info, base_name, data, source = ""):
def check_command(expr, expr_info):
name = expr['command']
- allow_star = expr.has_key('gen')
check_type(expr_info, "'data' for command '%s'" % name,
expr.get('data'), allow_dict=True, allow_optional=True,
- allow_metas=['struct'], allow_star=allow_star)
+ allow_metas=['struct'])
returns_meta = ['union', 'struct']
if name in returns_whitelist:
returns_meta += ['built-in', 'alternate', 'enum']
check_type(expr_info, "'returns' for command '%s'" % name,
expr.get('returns'), allow_array=True,
- allow_optional=True, allow_metas=returns_meta,
- allow_star=allow_star)
+ allow_optional=True, allow_metas=returns_meta)
def check_event(expr, expr_info):
global events
@@ -1114,7 +1105,6 @@ class QAPISchema(object):
('bool', 'boolean', 'bool', 'false'),
('any', 'value', 'QObject' + pointer_suffix, 'NULL')]:
self._def_builtin_type(*t)
- self._entity_dict['**'] = self.lookup_type('any') # TODO drop this alias
def _make_implicit_enum_type(self, name, values):
name = name + 'Kind'
@@ -1263,8 +1253,6 @@ class QAPISchema(object):
def visit(self, visitor):
visitor.visit_begin(self)
for name in sorted(self._entity_dict.keys()):
- if self._entity_dict[name].name != name:
- continue # ignore alias TODO drop alias and remove
self._entity_dict[name].visit(visitor)
visitor.visit_end()
diff --git a/tests/Makefile b/tests/Makefile
index fc6169a..68adad4 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -228,7 +228,7 @@ check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
bad-type-dict.json double-data.json unknown-expr-key.json \
redefined-type.json redefined-command.json redefined-builtin.json \
redefined-event.json command-int.json bad-data.json event-max.json \
- type-bypass.json type-bypass-no-gen.json type-bypass-bad-gen.json \
+ type-bypass-bad-gen.json \
args-invalid.json \
args-array-empty.json args-array-unknown.json args-int.json \
args-unknown.json args-member-unknown.json args-member-array.json \
diff --git a/tests/qapi-schema/type-bypass-no-gen.err b/tests/qapi-schema/type-bypass-no-gen.err
deleted file mode 100644
index 20cef0a..0000000
--- a/tests/qapi-schema/type-bypass-no-gen.err
+++ /dev/null
@@ -1 +0,0 @@
-tests/qapi-schema/type-bypass-no-gen.json:2: Member 'arg' of 'data' for command 'unsafe' uses '**' but did not request 'gen':false
diff --git a/tests/qapi-schema/type-bypass-no-gen.exit b/tests/qapi-schema/type-bypass-no-gen.exit
deleted file mode 100644
index d00491f..0000000
--- a/tests/qapi-schema/type-bypass-no-gen.exit
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/tests/qapi-schema/type-bypass-no-gen.json b/tests/qapi-schema/type-bypass-no-gen.json
deleted file mode 100644
index 4feae37..0000000
--- a/tests/qapi-schema/type-bypass-no-gen.json
+++ /dev/null
@@ -1,2 +0,0 @@
-# type bypass only works with 'gen':false
-{ 'command': 'unsafe', 'data': { 'arg': '**' }, 'returns': '**' }
diff --git a/tests/qapi-schema/type-bypass-no-gen.out b/tests/qapi-schema/type-bypass-no-gen.out
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/qapi-schema/type-bypass.err b/tests/qapi-schema/type-bypass.err
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/qapi-schema/type-bypass.exit b/tests/qapi-schema/type-bypass.exit
deleted file mode 100644
index 573541a..0000000
--- a/tests/qapi-schema/type-bypass.exit
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/tests/qapi-schema/type-bypass.json b/tests/qapi-schema/type-bypass.json
deleted file mode 100644
index 48b2137..0000000
--- a/tests/qapi-schema/type-bypass.json
+++ /dev/null
@@ -1,2 +0,0 @@
-# Use of 'gen':false allows bypassing type system
-{ 'command': 'unsafe', 'data': { 'arg': '**' }, 'returns': '**', 'gen': false }
diff --git a/tests/qapi-schema/type-bypass.out b/tests/qapi-schema/type-bypass.out
deleted file mode 100644
index db2a4e6..0000000
--- a/tests/qapi-schema/type-bypass.out
+++ /dev/null
@@ -1,4 +0,0 @@
-object :obj-unsafe-arg
- member arg: any optional=False
-command unsafe :obj-unsafe-arg -> any
- gen=False success_response=True
--
2.4.3
next prev parent reply other threads:[~2015-09-07 10:17 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-07 10:16 [Qemu-devel] [PATCH RFC v5 00/32] qapi: QMP introspection Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 01/32] qapi: Rename class QAPISchema to QAPISchemaParser Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 02/32] qapi: New QAPISchema intermediate reperesentation Markus Armbruster
2015-09-08 3:38 ` Eric Blake
2015-09-09 7:47 ` Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 03/32] qapi: QAPISchema code generation helper methods Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 04/32] qapi: New QAPISchemaVisitor Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 05/32] tests/qapi-schema: Convert test harness to QAPISchemaVisitor Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 06/32] qapi: Split up some typedefs to ease review Markus Armbruster
2015-09-08 12:25 ` Eric Blake
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 07/32] qapi: Generate comments to simplify splitting for review Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 08/32] Revert "qapi: Generate comments to simplify splitting for review" Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 09/32] Revert "qapi: Split up some typedefs to ease review" Markus Armbruster
2015-09-08 12:26 ` Eric Blake
2015-09-08 12:58 ` Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 10/32] qapi-types: Convert to QAPISchemaVisitor, fixing flat unions Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 11/32] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 12/32] qapi-commands: Convert to QAPISchemaVisitor Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 13/32] qapi: De-duplicate enum code generation Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 14/32] qapi-event: Eliminate global variable event_enum_value Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 15/32] qapi-event: Convert to QAPISchemaVisitor, fixing data with base Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 16/32] qapi: Generate comments to simplify splitting for review Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 17/32] Revert "qapi: Generate comments to simplify splitting for review" Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 18/32] qapi: Replace dirty is_c_ptr() by method c_null() Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 19/32] qapi: Clean up after recent conversions to QAPISchemaVisitor Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 20/32] qapi-visit: Rearrange code a bit Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 21/32] qapi-commands: Rearrange code Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 22/32] qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO() Markus Armbruster
2015-09-08 14:50 ` Eric Blake
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 23/32] qapi: De-duplicate parameter list generation Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 24/32] qapi-commands: De-duplicate output marshaling functions Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 25/32] qapi: Improve built-in type documentation Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 26/32] qapi: Introduce a first class 'any' type Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 27/32] qom: Don't use 'gen': false for qom-get, qom-set, object-add Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 28/32] qapi-schema: Fix up misleading specification of netdev_add Markus Armbruster
2015-09-07 10:16 ` Markus Armbruster [this message]
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-schema for QMP introspection Markus Armbruster
2015-09-08 16:11 ` Eric Blake
2015-09-08 18:48 ` Markus Armbruster
2015-09-08 20:06 ` Eric Blake
2015-09-09 6:31 ` Markus Armbruster
2015-09-10 22:12 ` Michael Roth
2015-09-11 7:02 ` Markus Armbruster
2015-09-11 8:33 ` Daniel P. Berrange
2015-09-11 13:30 ` Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 31/32] qapi-introspect: Map all integer types to 'int' Markus Armbruster
2015-09-07 10:16 ` [Qemu-devel] [PATCH RFC v5 32/32] qapi-introspect: Hide type names Markus Armbruster
2015-09-11 7:06 ` [Qemu-devel] [PATCH RFC v5 00/32] qapi: QMP introspection Markus Armbruster
2015-09-15 18:13 ` 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=1441621003-2434-30-git-send-email-armbru@redhat.com \
--to=armbru@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).