[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 27/31] qapi: Drop one of two "simple union must not
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 27/31] qapi: Drop one of two "simple union must not have base" checks |
Date: |
Mon, 31 Aug 2015 17:55:29 +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>
---
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] [PATCH v2 14/26] qapi: Document that input visitor semantics are prone to leaks, (continued)
- [Qemu-devel] [PATCH v2 14/26] qapi: Document that input visitor semantics are prone to leaks, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 19/26] qapi-tests: New tests for union, alternate command arguments, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 25/26] qapi-commands: Drop useless initialization, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 18/26] tests/qapi-schema: Rename tests from data- to args-, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 15/26] qapi: Document shortcoming with union 'data' branch, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 21/26] qapi: Command returning anonymous type doesn't work, outlaw, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 26/26] qapi: Generated code cleanup, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 22/26] qapi-commands: Fix gen_err_check(e) for e and e != 'local_err', Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 20/26] qapi: Fix to reject union command and event arguments, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH v2 24/26] qapi-commands: Don't feed output of mcgen() to mcgen() again, Markus Armbruster, 2015/08/28
- [Qemu-devel] [PATCH 27/31] qapi: Drop one of two "simple union must not have base" checks,
Markus Armbruster <=
- [Qemu-devel] [PATCH 31/31] qapi: Simplify error reporting for array types, Markus Armbruster, 2015/08/31
- [Qemu-devel] [PATCH 28/31] tests/qapi-schema: Cover two more syntax errors, Markus Armbruster, 2015/08/31
- [Qemu-devel] [PATCH 30/31] qapi: Fix errors for non-string, non-dictionary members, Markus Armbruster, 2015/08/31
- [Qemu-devel] [PATCH 29/31] tests/qapi-schema: Cover non-string, non-dictionary members, Markus Armbruster, 2015/08/31
- Re: [Qemu-devel] [PATCH v2 00/26] qapi: Another round of fixes and cleanups, Markus Armbruster, 2015/08/31