qemu-e2k/tests/qapi-schema
Eric Blake 9f08c8ec73 qapi: Lazy creation of array types
Commit ac88219a had several TODO markers about whether we needed
to automatically create the corresponding array type alongside
any other type.  It turns out that most of the time, we don't!

There are a few exceptions: 1) We have a few situations where we
use an array type in internal code but do not expose that type
through QMP; fix it by declaring a dummy type that forces the
generator to see that we want to use the array type.

2) The builtin arrays (such as intList for QAPI ['int']) must
always be generated, because of the way our QAPI_TYPES_BUILTIN
compile guard works: we have situations (at the very least
tests/test-qmp-output-visitor.c) that include both top-level
"qapi-types.h" (via "error.h") and a secondary
"test-qapi-types.h". If we were to only emit the builtin types
when used locally, then the first .h file would not include all
types, but the second .h does not declare anything at all because
the first .h set QAPI_TYPES_BUILTIN, and we would end up with
compilation error due to things like unknown type 'int8List'.

Actually, we may need to revisit how we do type guards, and
change from a single QAPI_TYPES_BUILTIN over to a different
usage pattern that does one #ifdef per qapi type - right now,
the only types that are declared multiple times between two qapi
.json files for inclusion by a single .c file happen to be the
builtin arrays.  But now that we have QAPI 'include' statements,
it is logical to assume that we will soon reach a point where
we want to reuse non-builtin types (yes, I'm thinking about what
it will take to add introspection to QGA, where we will want to
reuse the SchemaInfo type and friends).  One #ifdef per type
will help ensure that generating the same qapi type into more
than one qapi-types.h won't cause collisions when both are
included in the same .c file; but we also have to solve how to
avoid creating duplicate qapi-types.c entry points.  So that
is a problem left for another day.

Generated code for qapi-types and qapi-visit is drastically
reduced; less than a third of the arrays that were blindly
created were actually needed (a quick grep shows we dropped
from 219 to 69 *List types), and the .o files lost more than
30% of their bulk.  [For best results, diff the generated
files with 'git diff --patience --no-index pre post'.]

Interestingly, the introspection output is unchanged - this is
because we already cull all types that are not indirectly
reachable from a command or event, so introspection was already
using only a subset of array types.  The subset of types
introspected is now a much larger percentage of the overall set
of array types emitted in qapi-types.h (since the larger set
shrunk), but still not 100% (evidence that the array types
emitted for our new Dummy structs, and the new struct itself,
don't affect QMP).

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-9-git-send-email-eblake@redhat.com>
[Moved array info tracking to a later patch]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-10-15 08:39:08 +02:00
..
include
alternate-array.err
alternate-array.exit
alternate-array.json
alternate-array.out
alternate-base.err
alternate-base.exit qapi: Tighten checking of unions 2015-05-05 18:39:00 +02:00
alternate-base.json
alternate-base.out
alternate-clash.err
alternate-clash.exit
alternate-clash.json
alternate-clash.out
alternate-conflict-dict.err
alternate-conflict-dict.exit
alternate-conflict-dict.json
alternate-conflict-dict.out
alternate-conflict-string.err
alternate-conflict-string.exit
alternate-conflict-string.json
alternate-conflict-string.out qapi: Tighten checking of unions 2015-05-05 18:39:00 +02:00
alternate-empty.err
alternate-empty.exit
alternate-empty.json
alternate-empty.out qapi: Add tests for empty unions 2015-10-12 18:44:54 +02:00
alternate-nested.err
alternate-nested.exit
alternate-nested.json
alternate-nested.out
alternate-unknown.err qapi: More rigourous checking of types 2015-05-05 18:39:01 +02:00
alternate-unknown.exit
alternate-unknown.json
alternate-unknown.out
args-alternate.err
args-alternate.exit
args-alternate.json
args-alternate.out
args-any.err
args-any.exit
args-any.json
args-any.out
args-array-empty.err
args-array-empty.exit
args-array-empty.json
args-array-empty.out
args-array-unknown.err
args-array-unknown.exit
args-array-unknown.json
args-array-unknown.out
args-int.err
args-int.exit
args-int.json
args-int.out
args-invalid.err
args-invalid.exit
args-invalid.json
args-invalid.out
args-member-array-bad.err
args-member-array-bad.exit
args-member-array-bad.json
args-member-array-bad.out
args-member-unknown.err
args-member-unknown.exit
args-member-unknown.json
args-member-unknown.out tests/qapi-schema: Rename tests from data- to args- 2015-09-04 15:47:15 +02:00
args-name-clash.err
args-name-clash.exit
args-name-clash.json
args-name-clash.out
args-union.err
args-union.exit
args-union.json
args-union.out
args-unknown.err
args-unknown.exit
args-unknown.json
args-unknown.out
bad-base.err qapi: Prefer 'struct' over 'type' in generator 2015-05-05 18:39:01 +02:00
bad-base.exit
bad-base.json
bad-base.out
bad-data.err
bad-data.exit
bad-data.json
bad-data.out
bad-ident.err
bad-ident.exit
bad-ident.json
bad-ident.out
bad-type-bool.err
bad-type-bool.exit
bad-type-bool.json
bad-type-bool.out
bad-type-dict.err
bad-type-dict.exit
bad-type-dict.json
bad-type-dict.out
bad-type-int.err
bad-type-int.exit
bad-type-int.json
bad-type-int.out
command-int.err
command-int.exit
command-int.json
command-int.out
comments.err
comments.exit
comments.json
comments.out
double-data.err
double-data.exit
double-data.json
double-data.out
double-type.err
double-type.exit
double-type.json
double-type.out
duplicate-key.err
duplicate-key.exit
duplicate-key.json
duplicate-key.out
empty.err
empty.exit
empty.json
empty.out
enum-bad-name.err
enum-bad-name.exit
enum-bad-name.json
enum-bad-name.out
enum-bad-prefix.err
enum-bad-prefix.exit
enum-bad-prefix.json
enum-bad-prefix.out
enum-clash-member.err
enum-clash-member.exit
enum-clash-member.json
enum-clash-member.out
enum-dict-member.err
enum-dict-member.exit
enum-dict-member.json
enum-dict-member.out
enum-int-member.err
enum-int-member.exit qapi: Add some enum tests 2015-05-05 18:39:00 +02:00
enum-int-member.json
enum-int-member.out
enum-max-member.err
enum-max-member.exit
enum-max-member.json
enum-max-member.out
enum-missing-data.err
enum-missing-data.exit qapi: Add some enum tests 2015-05-05 18:39:00 +02:00
enum-missing-data.json
enum-missing-data.out
enum-union-clash.err
enum-union-clash.exit
enum-union-clash.json
enum-union-clash.out qapi: Better error messages for duplicated expressions 2015-05-05 18:39:01 +02:00
enum-wrong-data.err
enum-wrong-data.exit
enum-wrong-data.json
enum-wrong-data.out
escape-outside-string.err
escape-outside-string.exit
escape-outside-string.json
escape-outside-string.out
escape-too-big.err
escape-too-big.exit
escape-too-big.json
escape-too-big.out
escape-too-short.err
escape-too-short.exit
escape-too-short.json
escape-too-short.out qapi: Support (subset of) \u escapes in strings 2015-05-05 18:39:02 +02:00
event-case.err
event-case.exit
event-case.json
event-case.out
event-max.err qapi: Better error messages for duplicated expressions 2015-05-05 18:39:01 +02:00
event-max.exit
event-max.json
event-max.out
event-nest-struct.err
event-nest-struct.exit
event-nest-struct.json
event-nest-struct.out
flat-union-array-branch.err
flat-union-array-branch.exit tests/qapi-schema: New flat union array branch test case 2015-06-18 14:19:47 +02:00
flat-union-array-branch.json
flat-union-array-branch.out
flat-union-bad-base.err
flat-union-bad-base.exit
flat-union-bad-base.json
flat-union-bad-base.out
flat-union-bad-discriminator.err
flat-union-bad-discriminator.exit
flat-union-bad-discriminator.json
flat-union-bad-discriminator.out
flat-union-base-any.err
flat-union-base-any.exit
flat-union-base-any.json
flat-union-base-any.out
flat-union-base-union.err qapi: Reuse code for flat union base validation 2015-10-12 18:46:49 +02:00
flat-union-base-union.exit qapi: Add some union tests 2015-05-05 18:39:00 +02:00
flat-union-base-union.json
flat-union-base-union.out
flat-union-clash-branch.err
flat-union-clash-branch.exit
flat-union-clash-branch.json
flat-union-clash-branch.out
flat-union-clash-member.err
flat-union-clash-member.exit
flat-union-clash-member.json
flat-union-clash-member.out
flat-union-clash-type.err
flat-union-clash-type.exit
flat-union-clash-type.json
flat-union-clash-type.out
flat-union-empty.err
flat-union-empty.exit
flat-union-empty.json
flat-union-empty.out
flat-union-inline.err
flat-union-inline.exit
flat-union-inline.json
flat-union-inline.out
flat-union-int-branch.err
flat-union-int-branch.exit
flat-union-int-branch.json
flat-union-int-branch.out
flat-union-invalid-branch-key.err
flat-union-invalid-branch-key.exit
flat-union-invalid-branch-key.json
flat-union-invalid-branch-key.out
flat-union-invalid-discriminator.err
flat-union-invalid-discriminator.exit qapi script: check correctness of union 2014-03-11 09:07:41 -04:00
flat-union-invalid-discriminator.json
flat-union-invalid-discriminator.out
flat-union-no-base.err
flat-union-no-base.exit qapi script: check correctness of union 2014-03-11 09:07:41 -04:00
flat-union-no-base.json
flat-union-no-base.out
flat-union-optional-discriminator.err qapi: Require valid names 2015-05-05 18:39:01 +02:00
flat-union-optional-discriminator.exit
flat-union-optional-discriminator.json
flat-union-optional-discriminator.out
flat-union-string-discriminator.err
flat-union-string-discriminator.exit
flat-union-string-discriminator.json
flat-union-string-discriminator.out qapi script: do not allow string discriminator 2014-03-11 09:07:42 -04:00
funny-char.err
funny-char.exit
funny-char.json
funny-char.out qapi.py: Reject invalid characters in schema file 2013-07-29 10:37:11 -05:00
ident-with-escape.err
ident-with-escape.exit
ident-with-escape.json
ident-with-escape.out
include-before-err.err
include-before-err.exit
include-before-err.json
include-before-err.out
include-cycle-b.json
include-cycle-c.json
include-cycle.err
include-cycle.exit
include-cycle.json
include-cycle.out
include-format-err.err
include-format-err.exit qapi: Add a primitive to include other files from a QAPI schema file 2014-05-08 14:19:58 -04:00
include-format-err.json
include-format-err.out
include-nested-err.err qapi: Fix file name in error messages for included files 2015-06-18 14:12:34 +02:00
include-nested-err.exit
include-nested-err.json
include-nested-err.out
include-no-file.err
include-no-file.exit
include-no-file.json
include-no-file.out
include-non-file.err
include-non-file.exit qapi: Add a primitive to include other files from a QAPI schema file 2014-05-08 14:19:58 -04:00
include-non-file.json
include-non-file.out
include-relpath-sub.json
include-relpath.err
include-relpath.exit
include-relpath.json
include-relpath.out
include-repetition-sub.json
include-repetition.err qapi: skip redundant includes 2014-05-16 10:35:59 -04:00
include-repetition.exit
include-repetition.json
include-repetition.out
include-self-cycle.err
include-self-cycle.exit
include-self-cycle.json
include-self-cycle.out
include-simple-sub.json
include-simple.err
include-simple.exit
include-simple.json
include-simple.out
indented-expr.err
indented-expr.exit
indented-expr.json
indented-expr.out
leading-comma-list.err
leading-comma-list.exit
leading-comma-list.json
leading-comma-list.out
leading-comma-object.err
leading-comma-object.exit
leading-comma-object.json
leading-comma-object.out
missing-colon.err
missing-colon.exit
missing-colon.json
missing-colon.out
missing-comma-list.err
missing-comma-list.exit
missing-comma-list.json
missing-comma-list.out
missing-comma-object.err
missing-comma-object.exit
missing-comma-object.json
missing-comma-object.out
missing-type.err qapi: Better error messages for bad expressions 2015-05-05 18:39:01 +02:00
missing-type.exit
missing-type.json
missing-type.out
nested-struct-data.err
nested-struct-data.exit
nested-struct-data.json
nested-struct-data.out
non-objects.err
non-objects.exit
non-objects.json
non-objects.out
qapi-schema-test.err
qapi-schema-test.exit
qapi-schema-test.json
qapi-schema-test.out qapi: Lazy creation of array types 2015-10-15 08:39:08 +02:00
quoted-structural-chars.err
quoted-structural-chars.exit
quoted-structural-chars.json
quoted-structural-chars.out
redefined-builtin.err
redefined-builtin.exit
redefined-builtin.json
redefined-builtin.out
redefined-command.err qapi: Better error messages for duplicated expressions 2015-05-05 18:39:01 +02:00
redefined-command.exit
redefined-command.json
redefined-command.out
redefined-event.err
redefined-event.exit
redefined-event.json
redefined-event.out qapi: Better error messages for duplicated expressions 2015-05-05 18:39:01 +02:00
redefined-type.err
redefined-type.exit
redefined-type.json
redefined-type.out
returns-alternate.err
returns-alternate.exit
returns-alternate.json
returns-alternate.out
returns-array-bad.err
returns-array-bad.exit
returns-array-bad.json
returns-array-bad.out
returns-dict.err
returns-dict.exit qapi: Command returning anonymous type doesn't work, outlaw 2015-09-04 15:47:15 +02:00
returns-dict.json
returns-dict.out
returns-unknown.err
returns-unknown.exit
returns-unknown.json
returns-unknown.out qapi: More rigourous checking of types 2015-05-05 18:39:01 +02:00
returns-whitelist.err
returns-whitelist.exit
returns-whitelist.json
returns-whitelist.out
struct-base-clash-base.err
struct-base-clash-base.exit
struct-base-clash-base.json
struct-base-clash-base.out
struct-base-clash-deep.err
struct-base-clash-deep.exit
struct-base-clash-deep.json
struct-base-clash-deep.out
struct-base-clash.err
struct-base-clash.exit
struct-base-clash.json
struct-base-clash.out
struct-data-invalid.err
struct-data-invalid.exit
struct-data-invalid.json
struct-data-invalid.out
struct-member-invalid.err
struct-member-invalid.exit tests/qapi-schema: Cover non-string, non-dictionary members 2015-09-04 15:47:16 +02:00
struct-member-invalid.json
struct-member-invalid.out
test-qapi.py tests/qapi-schema: Convert test harness to QAPISchemaVisitor 2015-09-21 09:32:50 +02:00
trailing-comma-list.err
trailing-comma-list.exit
trailing-comma-list.json
trailing-comma-list.out qapi.py: Fix schema parser to check syntax systematically 2013-07-29 10:37:11 -05:00
trailing-comma-object.err
trailing-comma-object.exit
trailing-comma-object.json
trailing-comma-object.out
type-bypass-bad-gen.err
type-bypass-bad-gen.exit
type-bypass-bad-gen.json
type-bypass-bad-gen.out
unclosed-list.err qapi: Use an explicit input file 2014-05-08 14:19:58 -04:00
unclosed-list.exit
unclosed-list.json
unclosed-list.out
unclosed-object.err qapi: Use an explicit input file 2014-05-08 14:19:58 -04:00
unclosed-object.exit tests: QAPI schema parser tests 2013-07-29 10:37:10 -05:00
unclosed-object.json
unclosed-object.out
unclosed-string.err
unclosed-string.exit
unclosed-string.json
unclosed-string.out
unicode-str.err
unicode-str.exit
unicode-str.json
unicode-str.out
union-bad-branch.err
union-bad-branch.exit
union-bad-branch.json
union-bad-branch.out
union-base-no-discriminator.err
union-base-no-discriminator.exit
union-base-no-discriminator.json
union-base-no-discriminator.out qapi: Forbid base without discriminator in unions 2015-05-05 18:39:00 +02:00
union-clash-branches.err
union-clash-branches.exit
union-clash-branches.json
union-clash-branches.out
union-clash-data.err
union-clash-data.exit
union-clash-data.json
union-clash-data.out
union-clash-type.err
union-clash-type.exit
union-clash-type.json
union-clash-type.out
union-empty.err
union-empty.exit qapi: Add tests for empty unions 2015-10-12 18:44:54 +02:00
union-empty.json
union-empty.out
union-invalid-base.err
union-invalid-base.exit
union-invalid-base.json
union-invalid-base.out
union-max.err
union-max.exit
union-max.json
union-max.out qapi: Tighten checking of unions 2015-05-05 18:39:00 +02:00
union-optional-branch.err
union-optional-branch.exit
union-optional-branch.json
union-optional-branch.out
union-unknown.err
union-unknown.exit
union-unknown.json
union-unknown.out
unknown-escape.err
unknown-escape.exit
unknown-escape.json
unknown-escape.out
unknown-expr-key.err
unknown-expr-key.exit
unknown-expr-key.json
unknown-expr-key.out