Browse Source

qapi: Drop one of two "simple union must not have base" checks

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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Markus Armbruster 10 years ago
parent
commit
65fbe12545
2 changed files with 1 additions and 9 deletions
  1. 0 8
      scripts/qapi.py
  2. 1 1
      tests/qapi-schema/union-base-no-discriminator.err

+ 0 - 8
scripts/qapi.py

@@ -526,14 +526,6 @@ def check_union(expr, expr_info):
     members = expr['data']
     members = expr['data']
     values = { 'MAX': '(automatic)' }
     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.
     # Two types of unions, determined by discriminator.
 
 
     # With no discriminator it is a simple union.
     # With no discriminator it is a simple union.

+ 1 - 1
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