[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 27/33] qapi: Drop one of two "simple union must not h
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 27/33] qapi: Drop one of two "simple union must not have base" checks |
Date: |
Fri, 4 Sep 2015 16:21:34 +0200 |
The first check ensures the second one can't trigger. Drop the first
one, because the second one is in a more logical place, and emits a
nicer error message.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
scripts/qapi.py | 8 --------
tests/qapi-schema/union-base-no-discriminator.err | 2 +-
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 23c32fe..197db77 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -526,14 +526,6 @@ def check_union(expr, expr_info):
members = expr['data']
values = { 'MAX': '(automatic)' }
- # If the object has a member 'base', its value must name a struct,
- # and there must be a discriminator.
- if base is not None:
- if discriminator is None:
- raise QAPIExprError(expr_info,
- "Union '%s' requires a discriminator to go "
- "along with base" %name)
-
# Two types of unions, determined by discriminator.
# With no discriminator it is a simple union.
diff --git a/tests/qapi-schema/union-base-no-discriminator.err
b/tests/qapi-schema/union-base-no-discriminator.err
index fc8b79c..8b7a242 100644
--- a/tests/qapi-schema/union-base-no-discriminator.err
+++ b/tests/qapi-schema/union-base-no-discriminator.err
@@ -1 +1 @@
-tests/qapi-schema/union-base-no-discriminator.json:11: Union 'TestUnion'
requires a discriminator to go along with base
+tests/qapi-schema/union-base-no-discriminator.json:11: Simple union
'TestUnion' must not have a base
--
2.4.3
- [Qemu-devel] [PULL 05/33] qapi: Reject -p arguments that break qapi-event.py, (continued)
- [Qemu-devel] [PULL 05/33] qapi: Reject -p arguments that break qapi-event.py, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 03/33] qapi: Simplify guardname(), Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 01/33] qapi: Clarify docs on including the same file multiple times, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 11/33] qapi-visit: Fix two name arguments passed to visitors, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 07/33] qapi: Fix generated code when flat union has member 'kind', Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 14/33] qapi: Document that input visitor semantics are prone to leaks, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 13/33] tests/qapi-schema: Document events with base don't work, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 15/33] qapi: Document shortcoming with union 'data' branch, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 06/33] qapi: Drop unused and useless parameters and variables, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 23/33] qapi-commands: Inline gen_marshal_output_call(), Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 27/33] qapi: Drop one of two "simple union must not have base" checks,
Markus Armbruster <=
- [Qemu-devel] [PULL 25/33] qapi-commands: Drop useless initialization, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 02/33] qapi: Clean up cgen() and mcgen(), Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 22/33] qapi-commands: Fix gen_err_check(e) for e and e != 'local_err', Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 08/33] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 12/33] tests/qapi-schema: Document alternate's enum lacks visit function, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 16/33] qapi: Document flaws in checking of names, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 30/33] qapi: Fix errors for non-string, non-dictionary members, Markus Armbruster, 2015/09/04
- [Qemu-devel] [PULL 29/33] tests/qapi-schema: Cover non-string, non-dictionary members, Markus Armbruster, 2015/09/04