44bd1276a7
Previous commits demonstrated that the generator had several flaws with less-than-perfect unions: - a simple union that listed the same branch twice (or two variant names that map to the same C enumerator, including the implicit MAX sentinel) ended up generating invalid C code - an anonymous union that listed two branches with the same qtype ended up generating invalid C code - the generator crashed on anonymous union attempts to use an array type - the generator was silently ignoring a base type for anonymous unions - the generator allowed unknown types or nested anonymous unions as a branch in an anonymous union Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
13 lines
383 B
JSON
13 lines
383 B
JSON
# flat unions require a base
|
|
# TODO: simple unions should be able to use an enum discriminator
|
|
{ 'type': 'TestTypeA',
|
|
'data': { 'string': 'str' } }
|
|
{ 'type': 'TestTypeB',
|
|
'data': { 'integer': 'int' } }
|
|
{ 'enum': 'Enum',
|
|
'data': [ 'value1', 'value2' ] }
|
|
{ 'union': 'TestUnion',
|
|
'discriminator': 'Enum',
|
|
'data': { 'value1': 'TestTypeA',
|
|
'value2': 'TestTypeB' } }
|