qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 6fb554: qapi: Add copyright declaration on do


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 6fb554: qapi: Add copyright declaration on docs
Date: Wed, 06 May 2015 03:30:09 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 6fb55451728e6dc74ae4e67e4f5ab557468f084e
      
https://github.com/qemu/qemu/commit/6fb55451728e6dc74ae4e67e4f5ab557468f084e
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M docs/qmp/qmp-spec.txt

  Log Message:
  -----------
  qapi: Add copyright declaration on docs

While our top-level COPYING with its GPLv2+ license applies to
any documentation file that omits explicit instructions, these
days it's better to be a good example of calling out our
intentions.  Correct use of GPL requires the use of a copyright
statement, so I'm adding notice to two QAPI documents, by
attributing these files to the initial authors and major
contributors.  I used:

$ git blame --line-porcelain $file \
  | sed -n 's/^author //p' | sort | uniq -c | sort -rn

to determine authorship of these two files.  qmp-spec.txt blames
entirely to Red Hat (easy, since my contribution falls in that
category); while qapi-code-gen.txt has multiple contributors
representing multiple entities.  But since it was originally
supplied by Michael Roth, the notice I added there copies the
notice he has used in other files.  As there is no intended
change in license from the implicit one previously present from
the top level, I have not bothered to CC other contributors;
if we want to weaken things to something looser (such as LGPL)
so that there is no question that someone re-implementing the
spec is not forced to use GPL, that would be a different commit.

CC: Michael Roth <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: e790e666518e68134ca0570b6b4a707169ea3cb1
      
https://github.com/qemu/qemu/commit/e790e666518e68134ca0570b6b4a707169ea3cb1
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M docs/qmp/qmp-spec.txt

  Log Message:
  -----------
  qapi: Document type-safety considerations

Go into more details about the various types of valid expressions
in a qapi schema, including tweaks to document fixes being done
later in the current patch series.  Also fix some stale and missing
documentation in the QMP specification.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: b52c4b9cf0bbafdf8cede4ea1f62770d86815718
      
https://github.com/qemu/qemu/commit/b52c4b9cf0bbafdf8cede4ea1f62770d86815718
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Simplify builtin type handling

There was some redundancy between builtin_types[] and
builtin_type_qtypes{}.  Merge them into one.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: cb17f79eef0d161e81ac457e4c1f124405be2a18
      
https://github.com/qemu/qemu/commit/cb17f79eef0d161e81ac457e4c1f124405be2a18
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out

  Log Message:
  -----------
  qapi: Fix generation of 'size' builtin type

We were missing the 'size' builtin type (which means that QAPI using
[ 'size' ] would fail to compile).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: fe2a9303c9e511462f662a415c2e9d2defe9b7ca
      
https://github.com/qemu/qemu/commit/fe2a9303c9e511462f662a415c2e9d2defe9b7ca
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Require ASCII in schema

Python 2 and Python 3 have a wild history of whether strings
default to ascii or unicode, where Python 3 requires checking
isinstance(foo, basestr) to cover all strings, but where that
code is not portable to Python 2.  It's simpler to just state
that we don't care about Unicode strings, and to just always
use the simpler isinstance(foo, str) everywhere.

I'm no python expert, so I'm basing it on this conversation:
https://lists.gnu.org/archive/html/qemu-devel/2014-09/msg05278.html

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: ad11dbb93752ffd4bd1d5f31da7e2d9c40a68e8a
      
https://github.com/qemu/qemu/commit/ad11dbb93752ffd4bd1d5f31da7e2d9c40a68e8a
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/Makefile
    A tests/qapi-schema/enum-bad-name.err
    A tests/qapi-schema/enum-bad-name.exit
    A tests/qapi-schema/enum-bad-name.json
    A tests/qapi-schema/enum-bad-name.out
    A tests/qapi-schema/enum-clash-member.err
    A tests/qapi-schema/enum-clash-member.exit
    A tests/qapi-schema/enum-clash-member.json
    A tests/qapi-schema/enum-clash-member.out
    A tests/qapi-schema/enum-dict-member.err
    A tests/qapi-schema/enum-dict-member.exit
    A tests/qapi-schema/enum-dict-member.json
    A tests/qapi-schema/enum-dict-member.out
    A tests/qapi-schema/enum-empty.err
    A tests/qapi-schema/enum-empty.exit
    A tests/qapi-schema/enum-empty.json
    A tests/qapi-schema/enum-empty.out
    A tests/qapi-schema/enum-int-member.err
    A tests/qapi-schema/enum-int-member.exit
    A tests/qapi-schema/enum-int-member.json
    A tests/qapi-schema/enum-int-member.out
    A tests/qapi-schema/enum-max-member.err
    A tests/qapi-schema/enum-max-member.exit
    A tests/qapi-schema/enum-max-member.json
    A tests/qapi-schema/enum-max-member.out
    A tests/qapi-schema/enum-missing-data.err
    A tests/qapi-schema/enum-missing-data.exit
    A tests/qapi-schema/enum-missing-data.json
    A tests/qapi-schema/enum-missing-data.out
    A tests/qapi-schema/enum-union-clash.err
    A tests/qapi-schema/enum-union-clash.exit
    A tests/qapi-schema/enum-union-clash.json
    A tests/qapi-schema/enum-union-clash.out
    A tests/qapi-schema/enum-wrong-data.err
    A tests/qapi-schema/enum-wrong-data.exit
    A tests/qapi-schema/enum-wrong-data.json
    A tests/qapi-schema/enum-wrong-data.out

  Log Message:
  -----------
  qapi: Add some enum tests

Demonstrate that the qapi generator doesn't deal well with enums
that aren't up to par. Later patches will update the expected
results as the generator is made stricter.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: cf3935907b5df16f667d54ad6761c7e937dcf425
      
https://github.com/qemu/qemu/commit/cf3935907b5df16f667d54ad6761c7e937dcf425
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/enum-clash-member.err
    M tests/qapi-schema/enum-clash-member.exit
    M tests/qapi-schema/enum-clash-member.json
    M tests/qapi-schema/enum-clash-member.out
    M tests/qapi-schema/enum-dict-member.err
    M tests/qapi-schema/enum-dict-member.exit
    M tests/qapi-schema/enum-dict-member.json
    M tests/qapi-schema/enum-dict-member.out
    M tests/qapi-schema/enum-max-member.err
    M tests/qapi-schema/enum-max-member.exit
    M tests/qapi-schema/enum-max-member.json
    M tests/qapi-schema/enum-max-member.out
    M tests/qapi-schema/enum-missing-data.err
    M tests/qapi-schema/enum-missing-data.json
    M tests/qapi-schema/enum-wrong-data.err
    M tests/qapi-schema/enum-wrong-data.exit
    M tests/qapi-schema/enum-wrong-data.json
    M tests/qapi-schema/enum-wrong-data.out

  Log Message:
  -----------
  qapi: Better error messages for bad enums

The previous commit demonstrated that the generator had several
flaws with less-than-perfect enums:
- an enum that listed the same string twice (or two variant
strings that map to the same C enumerator) ended up generating
an invalid C enum
- because the generator adds a _MAX terminator to each enum,
the use of an enum member 'max' can also cause this clash
- if an enum omits 'data', the generator left a python stack
trace rather than a graceful message
- an enum that used a non-array 'data' was silently accepted by
the parser
- an enum that used non-string members in the 'data' member
was silently accepted by the parser

Add check_enum to cover these situations, and update testcases
to match.  While valid .json files won't trigger any of these
cases, we might as well be nicer to developers that make a typo
while trying to add new QAPI code.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 3d0c48292633260269cb21551d9bab006b2f2781
      
https://github.com/qemu/qemu/commit/3d0c48292633260269cb21551d9bab006b2f2781
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/Makefile
    A tests/qapi-schema/alternate-array.err
    A tests/qapi-schema/alternate-array.exit
    A tests/qapi-schema/alternate-array.json
    A tests/qapi-schema/alternate-array.out
    A tests/qapi-schema/alternate-base.err
    A tests/qapi-schema/alternate-base.exit
    A tests/qapi-schema/alternate-base.json
    A tests/qapi-schema/alternate-base.out
    A tests/qapi-schema/alternate-clash.err
    A tests/qapi-schema/alternate-clash.exit
    A tests/qapi-schema/alternate-clash.json
    A tests/qapi-schema/alternate-clash.out
    A tests/qapi-schema/alternate-conflict-dict.err
    A tests/qapi-schema/alternate-conflict-dict.exit
    A tests/qapi-schema/alternate-conflict-dict.json
    A tests/qapi-schema/alternate-conflict-dict.out
    A tests/qapi-schema/alternate-conflict-string.err
    A tests/qapi-schema/alternate-conflict-string.exit
    A tests/qapi-schema/alternate-conflict-string.json
    A tests/qapi-schema/alternate-conflict-string.out
    A tests/qapi-schema/alternate-good.err
    A tests/qapi-schema/alternate-good.exit
    A tests/qapi-schema/alternate-good.json
    A tests/qapi-schema/alternate-good.out
    A tests/qapi-schema/alternate-nested.err
    A tests/qapi-schema/alternate-nested.exit
    A tests/qapi-schema/alternate-nested.json
    A tests/qapi-schema/alternate-nested.out
    A tests/qapi-schema/alternate-unknown.err
    A tests/qapi-schema/alternate-unknown.exit
    A tests/qapi-schema/alternate-unknown.json
    A tests/qapi-schema/alternate-unknown.out
    A tests/qapi-schema/flat-union-bad-base.err
    A tests/qapi-schema/flat-union-bad-base.exit
    A tests/qapi-schema/flat-union-bad-base.json
    A tests/qapi-schema/flat-union-bad-base.out
    A tests/qapi-schema/flat-union-bad-discriminator.err
    A tests/qapi-schema/flat-union-bad-discriminator.exit
    A tests/qapi-schema/flat-union-bad-discriminator.json
    A tests/qapi-schema/flat-union-bad-discriminator.out
    A tests/qapi-schema/flat-union-base-star.err
    A tests/qapi-schema/flat-union-base-star.exit
    A tests/qapi-schema/flat-union-base-star.json
    A tests/qapi-schema/flat-union-base-star.out
    A tests/qapi-schema/flat-union-base-union.err
    A tests/qapi-schema/flat-union-base-union.exit
    A tests/qapi-schema/flat-union-base-union.json
    A tests/qapi-schema/flat-union-base-union.out
    A tests/qapi-schema/flat-union-branch-clash.err
    A tests/qapi-schema/flat-union-branch-clash.exit
    A tests/qapi-schema/flat-union-branch-clash.json
    A tests/qapi-schema/flat-union-branch-clash.out
    A tests/qapi-schema/flat-union-inline.err
    A tests/qapi-schema/flat-union-inline.exit
    A tests/qapi-schema/flat-union-inline.json
    A tests/qapi-schema/flat-union-inline.out
    A tests/qapi-schema/flat-union-int-branch.err
    A tests/qapi-schema/flat-union-int-branch.exit
    A tests/qapi-schema/flat-union-int-branch.json
    A tests/qapi-schema/flat-union-int-branch.out
    M tests/qapi-schema/flat-union-no-base.err
    M tests/qapi-schema/flat-union-no-base.json
    A tests/qapi-schema/flat-union-optional-discriminator.err
    A tests/qapi-schema/flat-union-optional-discriminator.exit
    A tests/qapi-schema/flat-union-optional-discriminator.json
    A tests/qapi-schema/flat-union-optional-discriminator.out
    A tests/qapi-schema/union-bad-branch.err
    A tests/qapi-schema/union-bad-branch.exit
    A tests/qapi-schema/union-bad-branch.json
    A tests/qapi-schema/union-bad-branch.out
    A tests/qapi-schema/union-base-no-discriminator.err
    A tests/qapi-schema/union-base-no-discriminator.exit
    A tests/qapi-schema/union-base-no-discriminator.json
    A tests/qapi-schema/union-base-no-discriminator.out
    M tests/qapi-schema/union-invalid-base.err
    M tests/qapi-schema/union-invalid-base.json
    A tests/qapi-schema/union-max.err
    A tests/qapi-schema/union-max.exit
    A tests/qapi-schema/union-max.json
    A tests/qapi-schema/union-max.out
    A tests/qapi-schema/union-optional-branch.err
    A tests/qapi-schema/union-optional-branch.exit
    A tests/qapi-schema/union-optional-branch.json
    A tests/qapi-schema/union-optional-branch.out
    A tests/qapi-schema/union-unknown.err
    A tests/qapi-schema/union-unknown.exit
    A tests/qapi-schema/union-unknown.json
    A tests/qapi-schema/union-unknown.out

  Log Message:
  -----------
  qapi: Add some union tests

Demonstrate that the qapi generator doesn't deal well with unions
that aren't up to par. Later patches will update the expected
reseults as the generator is made stricter.  A few tests work
as planned, but most show poor or missing error messages.

Of particular note, qapi-code-gen.txt documents 'base' only for
flat unions, but the tests here demonstrate that we currently allow
a 'base' to a simple union, although it is exercised only in the
testsuite.  Later patches will remove this undocumented feature, to
give us more flexibility in adding other future extensions to union
types.  For example, one possible extension is the idea of a
type-safe simple enum, where added fields tie the discriminator to
a user-defined enum type rather than creating an implicit enum from
the names in 'data'.  But adding such safety on top of a simple
enum with a base type could look ambiguous with a flat enum;
besides, the documentation also mentions how any simple union can
be represented by an equivalent flat union.  So it will be simpler
to just outlaw support for something we aren't using.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 805017b7791200f1b72deef17dc98fd272b941eb
      
https://github.com/qemu/qemu/commit/805017b7791200f1b72deef17dc98fd272b941eb
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  qapi: Clean up test coverage of simple unions

The tests of UserDefNativeListUnion serve to validate code
generation of simple unions without a base type, except that it
did not have full coverage in the strict test.  The next commits
will remove tests and support for simple unions with a base type,
so there is no real loss at repurposing that test here as
opposed to churn of adding a new test then deleting the old one.

Fix some indentation and long lines while at it.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: a8d4a2e4d7e1a0207699de47142c9bdbf2cc8675
      
https://github.com/qemu/qemu/commit/a8d4a2e4d7e1a0207699de47142c9bdbf2cc8675
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/union-base-no-discriminator.err
    M tests/qapi-schema/union-base-no-discriminator.exit
    M tests/qapi-schema/union-base-no-discriminator.json
    M tests/qapi-schema/union-base-no-discriminator.out
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  qapi: Forbid base without discriminator in unions

None of the existing QMP or QGA interfaces uses a union with a
base type but no discriminator; it is easier to avoid this in the
generator to save room for other future extensions more likely to
be useful.  An earlier commit added a union-base-no-discriminator
test to ensure that we eventually give a decent error message;
likewise, removing UserDefUnion outright is okay, because we moved
all the tests we wish to keep into the tests of the simple union
UserDefNativeListUnion in the previous commit.  Now is the time to
actually forbid simple union with base, and remove the last
vestiges from the testsuite.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 44bd1276a7dea747c41f250cb71ab65965343a7f
      
https://github.com/qemu/qemu/commit/44bd1276a7dea747c41f250cb71ab65965343a7f
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi.py
    M tests/qapi-schema/alternate-array.err
    M tests/qapi-schema/alternate-array.exit
    M tests/qapi-schema/alternate-array.json
    M tests/qapi-schema/alternate-array.out
    M tests/qapi-schema/alternate-base.err
    M tests/qapi-schema/alternate-base.exit
    M tests/qapi-schema/alternate-base.json
    M tests/qapi-schema/alternate-base.out
    M tests/qapi-schema/alternate-clash.err
    M tests/qapi-schema/alternate-clash.exit
    M tests/qapi-schema/alternate-clash.json
    M tests/qapi-schema/alternate-clash.out
    M tests/qapi-schema/alternate-conflict-dict.err
    M tests/qapi-schema/alternate-conflict-dict.exit
    M tests/qapi-schema/alternate-conflict-dict.json
    M tests/qapi-schema/alternate-conflict-dict.out
    M tests/qapi-schema/alternate-conflict-string.err
    M tests/qapi-schema/alternate-conflict-string.exit
    M tests/qapi-schema/alternate-conflict-string.json
    M tests/qapi-schema/alternate-conflict-string.out
    M tests/qapi-schema/alternate-nested.err
    M tests/qapi-schema/alternate-nested.exit
    M tests/qapi-schema/alternate-nested.json
    M tests/qapi-schema/alternate-nested.out
    M tests/qapi-schema/alternate-unknown.err
    M tests/qapi-schema/alternate-unknown.exit
    M tests/qapi-schema/alternate-unknown.json
    M tests/qapi-schema/alternate-unknown.out
    M tests/qapi-schema/flat-union-bad-base.err
    M tests/qapi-schema/flat-union-bad-base.json
    M tests/qapi-schema/flat-union-bad-discriminator.err
    M tests/qapi-schema/flat-union-bad-discriminator.exit
    M tests/qapi-schema/flat-union-bad-discriminator.json
    M tests/qapi-schema/flat-union-bad-discriminator.out
    M tests/qapi-schema/flat-union-inline.err
    M tests/qapi-schema/flat-union-inline.json
    M tests/qapi-schema/flat-union-no-base.err
    M tests/qapi-schema/flat-union-no-base.json
    M tests/qapi-schema/union-bad-branch.err
    M tests/qapi-schema/union-bad-branch.exit
    M tests/qapi-schema/union-bad-branch.json
    M tests/qapi-schema/union-bad-branch.out
    M tests/qapi-schema/union-max.err
    M tests/qapi-schema/union-max.exit
    M tests/qapi-schema/union-max.json
    M tests/qapi-schema/union-max.out

  Log Message:
  -----------
  qapi: Tighten checking of unions

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 <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 268a1c5eb10832c2e4476d3fe199ea547dabecb7
      
https://github.com/qemu/qemu/commit/268a1c5eb10832c2e4476d3fe199ea547dabecb7
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Prepare for catching more semantic parse errors

This patch widens the scope of a try block (with the attending
reindentation required by Python) in preparation for a future
patch adding more instances of QAPIExprError inside the block.
It's easier to separate indentation from semantic changes, so
this patch has no real behavior change.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 811d04fd0cff1229480d3f5b2e349f646ab6e3c1
      
https://github.com/qemu/qemu/commit/811d04fd0cff1229480d3f5b2e349f646ab6e3c1
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/qapi-schema/alternate-base.err
    M tests/qapi-schema/alternate-clash.err

  Log Message:
  -----------
  qapi: Segregate anonymous unions into alternates in generator

Special-casing 'discriminator == {}' for handling anonymous unions
is getting awkward; since this particular type is not always a
dictionary on the wire, it is easier to treat it as a completely
different class of type, "alternate", so that if a type is listed
in the union_types array, we know it is not an anonymous union.

This patch just further segregates union handling, to make sure that
anonymous unions are not stored in union_types, and splitting up
check_union() into separate functions.  A future patch will change
the qapi grammar, and having the segregation already in place will
make it easier to deal with the distinct meta-type.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: ab045267447d52e63a79c0e18f89ae4411f5420b
      
https://github.com/qemu/qemu/commit/ab045267447d52e63a79c0e18f89ae4411f5420b
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c

  Log Message:
  -----------
  qapi: Rename anonymous union type in test

Reduce churn in the future patch that replaces anonymous unions
with a new metatype 'alternate' by changing 'AnonUnion' to
'Alternate'.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 7b1b98c420355ccea98d8bd55c9193ee6b7cef97
      
https://github.com/qemu/qemu/commit/7b1b98c420355ccea98d8bd55c9193ee6b7cef97
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M docs/qapi-code-gen.txt

  Log Message:
  -----------
  qapi: Document new 'alternate' meta-type

The next patch will quit special-casing "'union':'Foo',
'discriminator':{}" and instead use "'alternate':'Foo'".

Separating docs from implementation makes it easier to focus
on wording without holding up code.  In particular, making
alternate a separate type makes for a nice type hierarchy:
     /-------- meta-type ------\
   /              |            \
    simple types    alternate     complex types
    |         |                   |           |
 built-in   enum             type(struct)   union
 |       \    /                            /    \
numeric  string                         simple  flat

A later patch will then clean up 'type' vs. 'struct'
confusion.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: ab916faddd16f0165e9cc2551f90699be8efde53
      
https://github.com/qemu/qemu/commit/ab916faddd16f0165e9cc2551f90699be8efde53
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M qapi/block-core.json
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/qapi-schema/alternate-array.err
    M tests/qapi-schema/alternate-array.json
    M tests/qapi-schema/alternate-base.err
    M tests/qapi-schema/alternate-base.json
    M tests/qapi-schema/alternate-clash.err
    M tests/qapi-schema/alternate-clash.json
    M tests/qapi-schema/alternate-conflict-dict.err
    M tests/qapi-schema/alternate-conflict-dict.json
    M tests/qapi-schema/alternate-conflict-string.err
    M tests/qapi-schema/alternate-conflict-string.json
    M tests/qapi-schema/alternate-good.json
    M tests/qapi-schema/alternate-good.out
    M tests/qapi-schema/alternate-nested.err
    M tests/qapi-schema/alternate-nested.json
    M tests/qapi-schema/alternate-unknown.err
    M tests/qapi-schema/alternate-unknown.json
    M tests/qapi-schema/flat-union-bad-discriminator.err
    M tests/qapi-schema/flat-union-bad-discriminator.json
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out

  Log Message:
  -----------
  qapi: Use 'alternate' to replace anonymous union

Previous patches have led up to the point where I create the
new meta-type "'alternate':'Foo'".  See the previous patches
for documentation; I intentionally split as much work into
earlier patches to minimize the size of this patch, but a lot
of it is churn due to testsuite fallout after updating to the
new type.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 9050c65b71ac1d197330e6db221f63189e21bad5
      
https://github.com/qemu/qemu/commit/9050c65b71ac1d197330e6db221f63189e21bad5
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/Makefile
    A tests/qapi-schema/bad-base.err
    A tests/qapi-schema/bad-base.exit
    A tests/qapi-schema/bad-base.json
    A tests/qapi-schema/bad-base.out
    A tests/qapi-schema/bad-ident.err
    A tests/qapi-schema/bad-ident.exit
    A tests/qapi-schema/bad-ident.json
    A tests/qapi-schema/bad-ident.out
    A tests/qapi-schema/bad-type-bool.err
    A tests/qapi-schema/bad-type-bool.exit
    A tests/qapi-schema/bad-type-bool.json
    A tests/qapi-schema/bad-type-bool.out
    A tests/qapi-schema/bad-type-dict.err
    A tests/qapi-schema/bad-type-dict.exit
    A tests/qapi-schema/bad-type-dict.json
    A tests/qapi-schema/bad-type-dict.out
    A tests/qapi-schema/bad-type-int.err
    A tests/qapi-schema/bad-type-int.exit
    A tests/qapi-schema/bad-type-int.json
    A tests/qapi-schema/bad-type-int.out
    A tests/qapi-schema/double-data.err
    A tests/qapi-schema/double-data.exit
    A tests/qapi-schema/double-data.json
    A tests/qapi-schema/double-data.out
    A tests/qapi-schema/double-type.err
    A tests/qapi-schema/double-type.exit
    A tests/qapi-schema/double-type.json
    A tests/qapi-schema/double-type.out
    A tests/qapi-schema/event-case.err
    A tests/qapi-schema/event-case.exit
    A tests/qapi-schema/event-case.json
    A tests/qapi-schema/event-case.out
    A tests/qapi-schema/ident-with-escape.err
    A tests/qapi-schema/ident-with-escape.exit
    A tests/qapi-schema/ident-with-escape.json
    A tests/qapi-schema/ident-with-escape.out
    A tests/qapi-schema/missing-type.err
    A tests/qapi-schema/missing-type.exit
    A tests/qapi-schema/missing-type.json
    A tests/qapi-schema/missing-type.out
    A tests/qapi-schema/unknown-expr-key.err
    A tests/qapi-schema/unknown-expr-key.exit
    A tests/qapi-schema/unknown-expr-key.json
    A tests/qapi-schema/unknown-expr-key.out

  Log Message:
  -----------
  qapi: Add some expr tests

Demonstrate that the qapi generator doesn't deal well with
expressions that aren't up to par. Later patches will improve
the expected results as the generator is made stricter.  Only
a few of the the added tests actually behave sanely at
rejecting obvious problems or demonstrating success.

Note that in some cases, we reject bad QAPI merely because our
pseudo-JSON parser does not yet know how to parse numbers.  This
series does not address that, but when a later series adds support
for numeric defaults of integer fields, the testsuite will ensure
that we don't lose the error (and hopefully that the error
message quality is improved).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 0545f6b8874c28d97369f2c83e5077e0461d4f12
      
https://github.com/qemu/qemu/commit/0545f6b8874c28d97369f2c83e5077e0461d4f12
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/alternate-base.err
    M tests/qapi-schema/bad-type-dict.err
    M tests/qapi-schema/bad-type-dict.exit
    M tests/qapi-schema/bad-type-dict.json
    M tests/qapi-schema/bad-type-dict.out
    M tests/qapi-schema/double-type.err
    M tests/qapi-schema/double-type.exit
    M tests/qapi-schema/double-type.json
    M tests/qapi-schema/double-type.out
    M tests/qapi-schema/enum-missing-data.err
    M tests/qapi-schema/ident-with-escape.err
    M tests/qapi-schema/ident-with-escape.exit
    M tests/qapi-schema/ident-with-escape.out
    M tests/qapi-schema/indented-expr.json
    M tests/qapi-schema/indented-expr.out
    M tests/qapi-schema/missing-type.err
    M tests/qapi-schema/missing-type.exit
    M tests/qapi-schema/missing-type.json
    M tests/qapi-schema/missing-type.out
    M tests/qapi-schema/unknown-expr-key.err
    M tests/qapi-schema/unknown-expr-key.exit
    M tests/qapi-schema/unknown-expr-key.json
    M tests/qapi-schema/unknown-expr-key.out

  Log Message:
  -----------
  qapi: Better error messages for bad expressions

The previous commit demonstrated that the generator overlooked some
fairly basic broken expressions:
- missing metataype
- metatype key has a non-string value
- unknown key in relation to the metatype
- conflicting metatype (this patch treats the second metatype as an
unknown key of the first key visited, which is not necessarily the
first key the user typed)

Add check_keys to cover these situations, and update testcases to
match.  A couple other tests (enum-missing-data, indented-expr) had
to change since the validation added here occurs so early.
Conversely, changes to ident-with-escape results show that we still
have problems where our handling of escape sequences differs from
true JSON, which will matter down the road if we allow arbitrary
default string values for optional parameters (but for now is not
too bad, as we currently can avoid unicode escaping as we don't
need to represent anything beyond C identifier material).

While valid .json files won't trigger any of these cases, we might
as well be nicer to developers that make a typo while trying to add
new QAPI code.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: cfdd5bcad515a8371af59dba9625e31a6f6f733e
      
https://github.com/qemu/qemu/commit/cfdd5bcad515a8371af59dba9625e31a6f6f733e
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/Makefile
    A tests/qapi-schema/command-int.err
    A tests/qapi-schema/command-int.exit
    A tests/qapi-schema/command-int.json
    A tests/qapi-schema/command-int.out
    A tests/qapi-schema/event-max.err
    A tests/qapi-schema/event-max.exit
    A tests/qapi-schema/event-max.json
    A tests/qapi-schema/event-max.out
    A tests/qapi-schema/redefined-builtin.err
    A tests/qapi-schema/redefined-builtin.exit
    A tests/qapi-schema/redefined-builtin.json
    A tests/qapi-schema/redefined-builtin.out
    A tests/qapi-schema/redefined-command.err
    A tests/qapi-schema/redefined-command.exit
    A tests/qapi-schema/redefined-command.json
    A tests/qapi-schema/redefined-command.out
    A tests/qapi-schema/redefined-event.err
    A tests/qapi-schema/redefined-event.exit
    A tests/qapi-schema/redefined-event.json
    A tests/qapi-schema/redefined-event.out
    A tests/qapi-schema/redefined-type.err
    A tests/qapi-schema/redefined-type.exit
    A tests/qapi-schema/redefined-type.json
    A tests/qapi-schema/redefined-type.out

  Log Message:
  -----------
  qapi: Add tests of redefined expressions

Demonstrate that the qapi generator doesn't deal very well with
redefined expressions.  At the parse level, they are silently
accepted; and while the testsuite just stops at parsing, I've
further tested that many of them cause generator crashes or
invalid C code if they were appended to qapi-schema-test.json.
A later patch will tighten things up and adjust the testsuite
to match.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 4dc2e6906e1084fdd37bf67385c5dcd2c72ae22b
      
https://github.com/qemu/qemu/commit/4dc2e6906e1084fdd37bf67385c5dcd2c72ae22b
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/command-int.err
    M tests/qapi-schema/command-int.exit
    M tests/qapi-schema/command-int.json
    M tests/qapi-schema/command-int.out
    M tests/qapi-schema/enum-union-clash.err
    M tests/qapi-schema/enum-union-clash.exit
    M tests/qapi-schema/enum-union-clash.json
    M tests/qapi-schema/enum-union-clash.out
    M tests/qapi-schema/event-max.err
    M tests/qapi-schema/event-max.exit
    M tests/qapi-schema/event-max.json
    M tests/qapi-schema/event-max.out
    M tests/qapi-schema/redefined-builtin.err
    M tests/qapi-schema/redefined-builtin.exit
    M tests/qapi-schema/redefined-builtin.json
    M tests/qapi-schema/redefined-builtin.out
    M tests/qapi-schema/redefined-command.err
    M tests/qapi-schema/redefined-command.exit
    M tests/qapi-schema/redefined-command.json
    M tests/qapi-schema/redefined-command.out
    M tests/qapi-schema/redefined-event.err
    M tests/qapi-schema/redefined-event.exit
    M tests/qapi-schema/redefined-event.json
    M tests/qapi-schema/redefined-event.out
    M tests/qapi-schema/redefined-type.err
    M tests/qapi-schema/redefined-type.exit
    M tests/qapi-schema/redefined-type.json
    M tests/qapi-schema/redefined-type.out

  Log Message:
  -----------
  qapi: Better error messages for duplicated expressions

The previous commit demonstrated that the generator overlooked
duplicate expressions:
- a complex type or command reusing a built-in type name
- redeclaration of a type name, whether by the same or different
metatype
- redeclaration of a command or event
- collision of a type with implicit 'Kind' enum for a union
- collision with an implicit MAX enum constant

Since the c_type() function in the generator treats all names
as being in the same namespace, this patch adds a global array
to track all known names and their source, to prevent collisions
before it can cause further problems.  While valid .json files
won't trigger any of these cases, we might as well be nicer to
developers that make a typo while trying to add new QAPI code.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: e53188ada516c814a729551be2448684d6d8ce08
      
https://github.com/qemu/qemu/commit/e53188ada516c814a729551be2448684d6d8ce08
  Author: Fam Zheng <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/bad-type-bool.err
    M tests/qapi-schema/bad-type-bool.json

  Log Message:
  -----------
  qapi: Allow true, false and null in schema json

In the near term, we will use it for a sensible-looking
'gen':false inside command declarations, instead of the
current ugly 'gen':'no'.

In the long term, it will allow conversion from shorthand
with defaults mentioned only in side-band documentation:
 'data':{'*flag':'bool', '*string':'str'}
into an explicit default value documentation, as in:
 'data':{'flag':{'type':'bool', 'optional':true, 'default':true},
   'string':{'type':'str', 'optional':true, 'default':null}}

We still don't parse integer values (also necessary before
we can allow explicit defaults), but that can come in a later
series.

Update the testsuite to match an improved error message.

Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: d708cdbe8792a55f53e90c1c787e871d527e8d4b
      
https://github.com/qemu/qemu/commit/d708cdbe8792a55f53e90c1c787e871d527e8d4b
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M qapi-schema.json
    M qga/qapi-schema.json
    M scripts/qapi-commands.py
    M tests/Makefile
    A tests/qapi-schema/type-bypass-bad-gen.err
    A tests/qapi-schema/type-bypass-bad-gen.exit
    A tests/qapi-schema/type-bypass-bad-gen.json
    A tests/qapi-schema/type-bypass-bad-gen.out
    A tests/qapi-schema/type-bypass-no-gen.err
    A tests/qapi-schema/type-bypass-no-gen.exit
    A tests/qapi-schema/type-bypass-no-gen.json
    A tests/qapi-schema/type-bypass-no-gen.out
    A tests/qapi-schema/type-bypass.err
    A tests/qapi-schema/type-bypass.exit
    A tests/qapi-schema/type-bypass.json
    A tests/qapi-schema/type-bypass.out

  Log Message:
  -----------
  qapi: Unify type bypass and add tests

For a few QMP commands, we are forced to pass an arbitrary type
without tracking it properly in QAPI.  Among the existing clients,
this unnamed type was spelled 'dict', 'visitor', and '**'; this
patch standardizes on '**', matching the documentation changes
earlier in the series.

Meanwhile, for the 'gen' key, we have been ignoring the value,
although the schema consistently used "'no'" ('success-response'
was hard-coded to checking for 'no').  But now that we can support
a literal "false" in the schema, we might as well use that rather
than ignoring the value or special-casing a random string.  Note
that these are one-way switches (use of 'gen':true is not the same
as omitting 'gen'). Also, the use of '**' requires 'gen':false,
but the use of 'gen':false does not mandate the use of '**'.

There is no difference to the generated code.  Add some tests on
what we'd like to guarantee, although it will take later patches
to clean up test results and actually enforce the use of a bool
parameter.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 0d8b9fb5f296a96723d98a45a6a00bfd4e45e1b9
      
https://github.com/qemu/qemu/commit/0d8b9fb5f296a96723d98a45a6a00bfd4e45e1b9
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/Makefile
    A tests/qapi-schema/bad-data.err
    A tests/qapi-schema/bad-data.exit
    A tests/qapi-schema/bad-data.json
    A tests/qapi-schema/bad-data.out
    A tests/qapi-schema/data-array-empty.err
    A tests/qapi-schema/data-array-empty.exit
    A tests/qapi-schema/data-array-empty.json
    A tests/qapi-schema/data-array-empty.out
    A tests/qapi-schema/data-array-unknown.err
    A tests/qapi-schema/data-array-unknown.exit
    A tests/qapi-schema/data-array-unknown.json
    A tests/qapi-schema/data-array-unknown.out
    A tests/qapi-schema/data-int.err
    A tests/qapi-schema/data-int.exit
    A tests/qapi-schema/data-int.json
    A tests/qapi-schema/data-int.out
    A tests/qapi-schema/data-member-array-bad.err
    A tests/qapi-schema/data-member-array-bad.exit
    A tests/qapi-schema/data-member-array-bad.json
    A tests/qapi-schema/data-member-array-bad.out
    A tests/qapi-schema/data-member-array.err
    A tests/qapi-schema/data-member-array.exit
    A tests/qapi-schema/data-member-array.json
    A tests/qapi-schema/data-member-array.out
    A tests/qapi-schema/data-member-unknown.err
    A tests/qapi-schema/data-member-unknown.exit
    A tests/qapi-schema/data-member-unknown.json
    A tests/qapi-schema/data-member-unknown.out
    A tests/qapi-schema/data-unknown.err
    A tests/qapi-schema/data-unknown.exit
    A tests/qapi-schema/data-unknown.json
    A tests/qapi-schema/data-unknown.out
    A tests/qapi-schema/nested-struct-data.err
    A tests/qapi-schema/nested-struct-data.exit
    A tests/qapi-schema/nested-struct-data.json
    A tests/qapi-schema/nested-struct-data.out
    A tests/qapi-schema/nested-struct-returns.err
    A tests/qapi-schema/nested-struct-returns.exit
    A tests/qapi-schema/nested-struct-returns.json
    A tests/qapi-schema/nested-struct-returns.out
    A tests/qapi-schema/returns-alternate.err
    A tests/qapi-schema/returns-alternate.exit
    A tests/qapi-schema/returns-alternate.json
    A tests/qapi-schema/returns-alternate.out
    A tests/qapi-schema/returns-array-bad.err
    A tests/qapi-schema/returns-array-bad.exit
    A tests/qapi-schema/returns-array-bad.json
    A tests/qapi-schema/returns-array-bad.out
    A tests/qapi-schema/returns-int.err
    A tests/qapi-schema/returns-int.exit
    A tests/qapi-schema/returns-int.json
    A tests/qapi-schema/returns-int.out
    A tests/qapi-schema/returns-unknown.err
    A tests/qapi-schema/returns-unknown.exit
    A tests/qapi-schema/returns-unknown.json
    A tests/qapi-schema/returns-unknown.out
    A tests/qapi-schema/returns-whitelist.err
    A tests/qapi-schema/returns-whitelist.exit
    A tests/qapi-schema/returns-whitelist.json
    A tests/qapi-schema/returns-whitelist.out

  Log Message:
  -----------
  qapi: Add some type check tests

Demonstrate that the qapi generator silently parses confusing
types, which may cause other errors later on. Later patches
will update the expected results as the generator is made stricter.

Most of the new tests focus on blatant errors.  But
returns-whitelist is a case where we have historically allowed
returning something other than a JSON object from particular
commands; we have to keep that behavior to avoid breaking clients,
but it would be nicer to avoid adding such commands in the future,
because any return that is not an (array of) object cannot be
easily extended if future qemu wants to return additional
information.  The QMP protocol already documents that clients
should ignore unknown dictionary keys, but does not require
clients to have to handle more than one type of JSON object.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: dd883c6f0547f02ae805d02852ff3691f6d08f85
      
https://github.com/qemu/qemu/commit/dd883c6f0547f02ae805d02852ff3691f6d08f85
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/alternate-array.err
    M tests/qapi-schema/alternate-nested.err
    M tests/qapi-schema/alternate-unknown.err
    M tests/qapi-schema/bad-base.err
    M tests/qapi-schema/bad-base.exit
    M tests/qapi-schema/bad-base.json
    M tests/qapi-schema/bad-base.out
    M tests/qapi-schema/bad-data.err
    M tests/qapi-schema/bad-data.exit
    M tests/qapi-schema/bad-data.json
    M tests/qapi-schema/bad-data.out
    M tests/qapi-schema/data-array-empty.err
    M tests/qapi-schema/data-array-empty.exit
    M tests/qapi-schema/data-array-empty.json
    M tests/qapi-schema/data-array-empty.out
    M tests/qapi-schema/data-array-unknown.err
    M tests/qapi-schema/data-array-unknown.exit
    M tests/qapi-schema/data-array-unknown.json
    M tests/qapi-schema/data-array-unknown.out
    M tests/qapi-schema/data-int.err
    M tests/qapi-schema/data-int.exit
    M tests/qapi-schema/data-int.json
    M tests/qapi-schema/data-int.out
    M tests/qapi-schema/data-member-array-bad.err
    M tests/qapi-schema/data-member-array-bad.exit
    M tests/qapi-schema/data-member-array-bad.json
    M tests/qapi-schema/data-member-array-bad.out
    M tests/qapi-schema/data-member-unknown.err
    M tests/qapi-schema/data-member-unknown.exit
    M tests/qapi-schema/data-member-unknown.json
    M tests/qapi-schema/data-member-unknown.out
    M tests/qapi-schema/data-unknown.err
    M tests/qapi-schema/data-unknown.exit
    M tests/qapi-schema/data-unknown.json
    M tests/qapi-schema/data-unknown.out
    M tests/qapi-schema/flat-union-int-branch.err
    M tests/qapi-schema/flat-union-int-branch.exit
    M tests/qapi-schema/flat-union-int-branch.json
    M tests/qapi-schema/flat-union-int-branch.out
    M tests/qapi-schema/returns-array-bad.err
    M tests/qapi-schema/returns-array-bad.exit
    M tests/qapi-schema/returns-array-bad.json
    M tests/qapi-schema/returns-array-bad.out
    M tests/qapi-schema/returns-unknown.err
    M tests/qapi-schema/returns-unknown.exit
    M tests/qapi-schema/returns-unknown.json
    M tests/qapi-schema/returns-unknown.out
    M tests/qapi-schema/union-unknown.err
    M tests/qapi-schema/union-unknown.exit
    M tests/qapi-schema/union-unknown.json
    M tests/qapi-schema/union-unknown.out

  Log Message:
  -----------
  qapi: More rigourous checking of types

Now that we know every expression is valid with regards to
its keys, we can add further tests that those keys refer to
valid types.  With this patch, all uses of a type (the 'data':
of command, type, union, alternate, and event; the 'returns':
of command; the 'base': of type and union) must resolve to an
appropriate subset of metatypes  declared by the current qapi
parse; this includes recursing into each member of a data
dictionary.  Dealing with '**' and nested anonymous structs
will be done in later patches.

Update the testsuite to match improved output.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: c9e0a798691d8c45747b082206e789c8f50523c9
      
https://github.com/qemu/qemu/commit/c9e0a798691d8c45747b082206e789c8f50523c9
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/bad-ident.err
    M tests/qapi-schema/bad-ident.exit
    M tests/qapi-schema/bad-ident.json
    M tests/qapi-schema/bad-ident.out
    M tests/qapi-schema/enum-bad-name.err
    M tests/qapi-schema/enum-bad-name.exit
    M tests/qapi-schema/enum-bad-name.json
    M tests/qapi-schema/enum-bad-name.out
    M tests/qapi-schema/enum-dict-member.err
    M tests/qapi-schema/flat-union-bad-discriminator.err
    M tests/qapi-schema/flat-union-optional-discriminator.err
    M tests/qapi-schema/flat-union-optional-discriminator.exit
    M tests/qapi-schema/flat-union-optional-discriminator.json
    M tests/qapi-schema/flat-union-optional-discriminator.out
    M tests/qapi-schema/union-optional-branch.err
    M tests/qapi-schema/union-optional-branch.exit
    M tests/qapi-schema/union-optional-branch.json
    M tests/qapi-schema/union-optional-branch.out

  Log Message:
  -----------
  qapi: Require valid names

Previous commits demonstrated that the generator overlooked various
bad naming situations:
- types, commands, and events need a valid name
- enum members must be valid names, when combined with prefix
- union and alternate branches cannot be marked optional

Valid upstream names match [a-zA-Z][a-zA-Z0-9_-]*; valid downstream
names match __[a-zA-Z][a-zA-Z0-9._-]*.  Enumerations match the
weaker [a-zA-Z0-9._-]+ (in part thanks to QKeyCode picking an enum
that starts with a digit, which we can't change now due to
backwards compatibility).  Rather than call out three separate
regex, this patch just uses a broader combination that allows both
upstream and downstream names, as well as a small hack that
realizes that any enum name is merely a suffix to an already valid
name prefix (that is, any enum name is valid if prepending _ fits
the normal rules).

We could reject new enumeration names beginning with a digit by
whitelisting existing exceptions.  We could also be stricter
about the distinction between upstream names (no leading
underscore, no use of dot) and downstream (mandatory leading
double underscore), but it is probably not worth the bother.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 10d4d997f86cf2a4ce89145df5658952d5722e56
      
https://github.com/qemu/qemu/commit/10d4d997f86cf2a4ce89145df5658952d5722e56
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/returns-alternate.err
    M tests/qapi-schema/returns-alternate.exit
    M tests/qapi-schema/returns-alternate.json
    M tests/qapi-schema/returns-alternate.out
    M tests/qapi-schema/returns-int.json
    M tests/qapi-schema/returns-int.out
    M tests/qapi-schema/returns-whitelist.err
    M tests/qapi-schema/returns-whitelist.exit
    M tests/qapi-schema/returns-whitelist.json
    M tests/qapi-schema/returns-whitelist.out

  Log Message:
  -----------
  qapi: Whitelist commands that don't return dictionary

...or an array of dictionaries.  Although we have to cater to
existing commands, returning a non-dictionary means the command
is not extensible (no new name/value pairs can be added if more
information must be returned in parallel).  By making the
whitelist explicit, any new command that falls foul of this
practice will have to be self-documenting, which will encourage
developers to either justify the action or rework the design to
use a dictionary after all.

It's a little bit sloppy that we share a single whitelist among
three clients (it's too permissive for each).  If this is a
problem, a future patch could tighten things by having the
generator take the whitelist as an argument (as in
scripts/qapi-commands.py --legacy-returns=...), or by having
the generator output C code that requires explicit use of the
whitelist (as in:
 #ifndef FROBNICATE_LEGACY_RETURN_OK
 # error Command 'frobnicate' should return a dictionary
 #endif
then having the callers define appropriate macros).  But until
we need such fine-grained separation (if ever), this patch does
the job just fine.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 2cbf09925ad45401673a79ab77f67de2f04a826c
      
https://github.com/qemu/qemu/commit/2cbf09925ad45401673a79ab77f67de2f04a826c
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/qapi-schema/type-bypass-bad-gen.err
    M tests/qapi-schema/type-bypass-bad-gen.exit
    M tests/qapi-schema/type-bypass-bad-gen.json
    M tests/qapi-schema/type-bypass-bad-gen.out
    M tests/qapi-schema/type-bypass-no-gen.err
    M tests/qapi-schema/type-bypass-no-gen.exit
    M tests/qapi-schema/type-bypass-no-gen.json
    M tests/qapi-schema/type-bypass-no-gen.out

  Log Message:
  -----------
  qapi: More rigorous checking for type safety bypass

Now that we have a way to validate every type, we can also be
stricter about enforcing that callers that want to bypass
type safety in generated code.  Prior to this patch, it didn't
matter what value was associated with the key 'gen', but it
looked odd that 'gen':'yes' could result in bypassing the
generated code.  These changes also enforce the changes made
earlier in the series for documentation and consolidation of
using '**' as the wildcard type, as well as 'gen':false as the
canonical spelling for requesting type bypass.

Note that 'gen':false is a one-way switch away from the default;
we do not support 'gen':true (similar for 'success-response').
In practice, this doesn't matter.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: fd41dd4eae5f7ea92f10c04cb3f217727fcee91f
      
https://github.com/qemu/qemu/commit/fd41dd4eae5f7ea92f10c04cb3f217727fcee91f
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/qapi-schema/alternate-good.out
    M tests/qapi-schema/bad-base.err
    M tests/qapi-schema/bad-ident.err
    M tests/qapi-schema/bad-type-bool.err
    M tests/qapi-schema/data-member-array.out
    M tests/qapi-schema/double-type.err
    M tests/qapi-schema/flat-union-bad-base.json
    M tests/qapi-schema/flat-union-base-star.err
    M tests/qapi-schema/flat-union-base-star.json
    M tests/qapi-schema/flat-union-base-union.err
    M tests/qapi-schema/flat-union-base-union.json
    M tests/qapi-schema/flat-union-branch-clash.out
    M tests/qapi-schema/flat-union-inline.json
    M tests/qapi-schema/flat-union-int-branch.json
    M tests/qapi-schema/flat-union-invalid-discriminator.err
    M tests/qapi-schema/flat-union-reverse-define.out
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/union-invalid-base.err
    M tests/qapi-schema/unknown-expr-key.err

  Log Message:
  -----------
  qapi: Prefer 'struct' over 'type' in generator

Referring to "type" as both a meta-type (built-in, enum, union,
alternate, or struct) and a specific type (the name that the
schema uses for declaring structs) is confusing.  The confusion
is only made worse by the fact that the generator mostly already
refers to struct even when dealing with expr['type'].  This
commit changes the generator to consistently refer to it as
struct everywhere, plus a single back-compat tweak that allows
accepting the existing .json files as-is, so that the meat of
this change is separate from the mindless churn of that change.

Fix the testsuite fallout for error messages that change, and
in some cases, become more legible.  Improve comments to better
match our intentions where a struct (rather than any complex
type) is required.  Note that in some cases, an error message
now refers to 'struct' while the schema still refers to 'type';
that will be cleaned up in the later commit to the schema.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 3b2a8b85322f3677525a65c0b35deadf45fb704b
      
https://github.com/qemu/qemu/commit/3b2a8b85322f3677525a65c0b35deadf45fb704b
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M docs/qapi-code-gen.txt

  Log Message:
  -----------
  qapi: Document 'struct' metatype

Referring to "type" as both a meta-type (built-in, enum, union,
alternate, or struct) and a specific type (the name that the
schema uses for declaring structs) is confusing.  Now that the
generator accepts 'struct' as a synonym for 'type', update all
documentation to use saner wording.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 895a2a80e0e054f0d5d3715aa93d10d15e49f9f7
      
https://github.com/qemu/qemu/commit/895a2a80e0e054f0d5d3715aa93d10d15e49f9f7
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M qapi-schema.json
    M qapi/block-core.json
    M qapi/block.json
    M qapi/common.json
    M qapi/trace.json
    M qga/qapi-schema.json
    M tests/qapi-schema/alternate-array.json
    M tests/qapi-schema/alternate-base.json
    M tests/qapi-schema/alternate-conflict-dict.json
    M tests/qapi-schema/alternate-good.json
    M tests/qapi-schema/bad-base.json
    M tests/qapi-schema/bad-ident.json
    M tests/qapi-schema/bad-type-bool.json
    M tests/qapi-schema/bad-type-int.err
    M tests/qapi-schema/bad-type-int.json
    M tests/qapi-schema/data-member-array.json
    M tests/qapi-schema/double-data.err
    M tests/qapi-schema/double-data.json
    M tests/qapi-schema/double-type.json
    M tests/qapi-schema/flat-union-bad-base.json
    M tests/qapi-schema/flat-union-bad-discriminator.json
    M tests/qapi-schema/flat-union-base-star.json
    M tests/qapi-schema/flat-union-base-union.json
    M tests/qapi-schema/flat-union-branch-clash.json
    M tests/qapi-schema/flat-union-inline.json
    M tests/qapi-schema/flat-union-int-branch.json
    M tests/qapi-schema/flat-union-invalid-branch-key.json
    M tests/qapi-schema/flat-union-invalid-discriminator.json
    M tests/qapi-schema/flat-union-no-base.json
    M tests/qapi-schema/flat-union-optional-discriminator.json
    M tests/qapi-schema/flat-union-reverse-define.json
    M tests/qapi-schema/flat-union-string-discriminator.json
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/redefined-builtin.json
    M tests/qapi-schema/redefined-type.json
    M tests/qapi-schema/union-bad-branch.json
    M tests/qapi-schema/union-base-no-discriminator.json
    M tests/qapi-schema/union-invalid-base.json
    M tests/qapi-schema/unknown-expr-key.json

  Log Message:
  -----------
  qapi: Use 'struct' instead of 'type' in schema

Referring to "type" as both a meta-type (built-in, enum, union,
alternate, or struct) and a specific type (the name that the
schema uses for declaring structs) is confusing.  Do the bulk of
the conversion to "struct" in qapi schema, with a fairly
mechanical:

for f in `find -name '*.json'; do sed -i "s/'type'/'struct'/"; done

followed by manually filtering out the places where we have a
'type' embedded in 'data'.  Then tweak a couple of tests whose
output changes slightly due to longer lines.

I also verified that the generated files for QMP and QGA (such
as qmp-commands.h) are the same before and after, as assurance
that I didn't leave in any accidental member name changes.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 3e391d355644b2bff7c9f187759aadb46c6e051f
      
https://github.com/qemu/qemu/commit/3e391d355644b2bff7c9f187759aadb46c6e051f
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py

  Log Message:
  -----------
  qapi: Forbid 'type' in schema

Referring to "type" as both a meta-type (built-in, enum, union,
alternate, or struct) and a specific type (the name that the
schema uses for declaring structs) is confusing.  Finish up the
conversion to using "struct" in qapi schema by removing the hack
in the generator that allowed 'type'.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: b6fcf32d9b851a83dedcb609091236b97cc4a985
      
https://github.com/qemu/qemu/commit/b6fcf32d9b851a83dedcb609091236b97cc4a985
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/test-qmp-commands.c
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c
    M tests/test-visitor-serialization.c

  Log Message:
  -----------
  qapi: Merge UserDefTwo and UserDefNested in tests

In the testsuite, UserDefTwo and UserDefNested were identical
structs other than the member names.  Reduce code duplication by
having just one type, and choose names that also favor reuse.
This will also make it easier for a later patch to get rid of
inline nested types in QAPI.  When touching code related to
allocations, convert g_malloc0(sizeof(Type)) to the more typesafe
g_new0(Type, 1).

Ensure that 'make check-qapi-schema check-unit' still passes.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 6446a592760155bb3e2e248d56bab97a34af0336
      
https://github.com/qemu/qemu/commit/6446a592760155bb3e2e248d56bab97a34af0336
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/test-qmp-commands.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c
    M tests/test-visitor-serialization.c

  Log Message:
  -----------
  qapi: Drop tests for inline nested structs

A future patch will be using a 'name':{dictionary} entry in the
QAPI schema to specify a default value for an optional argument;
but existing use of inline nested structs conflicts with that goal.

More precisely, a definition in the QAPI schema associates a name
with a set of properties:

Example 1: { 'struct': 'Foo', 'data': { MEMBERS... } }
associates the global name 'Foo' with properties (meta-type struct)
and MEMBERS...

Example 2: 'mumble': TYPE
within MEMBERS... above associates 'mumble' with properties (type
TYPE) and (optional false) within type Foo

The syntax of example 1 is extensible; if we need another property,
we add another name/value pair to the dictionary (such as
'base':TYPE).  The syntax of example 2 is not extensible, because
the right hand side can only be a type.

We have used name encoding to add a property: "'*mumble': 'int'"
associates 'mumble' with (type int) and (optional true).  Nice,
but doesn't scale.  So the solution is to change our existing uses
to be syntactic sugar to an extensible form:

   NAME: TYPE   --> NAME:  { 'type': TYPE, 'optional': false }
   *ONAME: TYPE --> ONAME: { 'type': TYPE, 'optional': true }

This patch fixes the testsuite to avoid inline nested types, by
breaking the nesting into explicit types; it means that the type
is now boxed instead of unboxed in C code, but makes no difference
on the wire (and if desired, a later patch could change the
generator to not do so much boxing in C).  When touching code to
add new allocations, also convert existing allocations to
consistently prefer typesafe g_new0 over g_malloc0 when a type
name is involved.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 4752cdbbf330ac7c593a6f337b97a79648f3f878
      
https://github.com/qemu/qemu/commit/4752cdbbf330ac7c593a6f337b97a79648f3f878
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M hmp.c
    M qapi/common.json
    M qmp.c

  Log Message:
  -----------
  qapi: Drop inline nested struct in query-version

A future patch will be using a 'name':{dictionary} entry in the
QAPI schema to specify a default value for an optional argument
(see previous commit message for more details why); but existing
use of inline nested structs conflicts with that goal. This patch
fixes one of only two commands relying on nested types, by
breaking the nesting into an explicit type; it means that the
type is now boxed instead of unboxed in C code, but the QMP wire
format is unaffected by this change.

Prefer the safer g_new0() while making the conversion.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 9fa02cd194a131aca75ab646ece975b6835400e1
      
https://github.com/qemu/qemu/commit/9fa02cd194a131aca75ab646ece975b6835400e1
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M hmp.c
    M hw/pci/pci.c
    M qapi-schema.json

  Log Message:
  -----------
  qapi: Drop inline nested structs in query-pci

A future patch will be using a 'name':{dictionary} entry in the
QAPI schema to specify a default value for an optional argument
(see previous commit message for more details why); but existing
use of inline nested structs conflicts with that goal. This patch
fixes one of only two commands relying on nested types, by
breaking the nesting into an explicit type; it means that the
type is now boxed instead of unboxed in C code, but the QMP wire
format is unaffected by this change.

Prefer the safer g_new0() while making the conversion, and reduce
some long lines.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 6b5abc7df7ef9aadb3ff0eba6ccf4f1f0181e2e1
      
https://github.com/qemu/qemu/commit/6b5abc7df7ef9aadb3ff0eba6ccf4f1f0181e2e1
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-commands.py
    M scripts/qapi-event.py
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/qapi-schema/event-nest-struct.err
    M tests/qapi-schema/nested-struct-data.err
    M tests/qapi-schema/nested-struct-data.exit
    M tests/qapi-schema/nested-struct-data.json
    M tests/qapi-schema/nested-struct-data.out
    M tests/qapi-schema/nested-struct-returns.err
    M tests/qapi-schema/nested-struct-returns.exit
    M tests/qapi-schema/nested-struct-returns.json
    M tests/qapi-schema/nested-struct-returns.out

  Log Message:
  -----------
  qapi: Drop support for inline nested types

A future patch will be using a 'name':{dictionary} entry in the
QAPI schema to specify a default value for an optional argument
(see previous commit messages for more details why); but existing
use of inline nested structs conflicts with that goal. Now that
all commands have been changed to avoid inline nested structs,
nuke support for them, and turn it into a hard error. Update the
testsuite to reflect tighter parsing rules.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: a82b982e2bddf7cd7cb490f83643e952e17d4523
      
https://github.com/qemu/qemu/commit/a82b982e2bddf7cd7cb490f83643e952e17d4523
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi-visit.py

  Log Message:
  -----------
  qapi: Drop dead visitor code related to nested structs

Now that we no longer have nested structs to visit, the use of
prefix strings is no longer required.  Remove the code that is
no longer reachable.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 363b4262a10a52f6d7ac1073bab5e6648da4051b
      
https://github.com/qemu/qemu/commit/363b4262a10a52f6d7ac1073bab5e6648da4051b
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M docs/qapi-code-gen.txt

  Log Message:
  -----------
  qapi: Tweak doc references to QMP when QGA is also meant

We have more than one qapi schema in use by more than one protocol.
Add a new term 'Client JSON Protocol' for use throughout the
document, to avoid confusion on whether something refers only to
QMP and not QGA.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: a7f5966b297330f6492020019544ae87c45d699b
      
https://github.com/qemu/qemu/commit/a7f5966b297330f6492020019544ae87c45d699b
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/escape-outside-string.err
    A tests/qapi-schema/escape-outside-string.exit
    A tests/qapi-schema/escape-outside-string.json
    A tests/qapi-schema/escape-outside-string.out
    A tests/qapi-schema/escape-too-big.err
    A tests/qapi-schema/escape-too-big.exit
    A tests/qapi-schema/escape-too-big.json
    A tests/qapi-schema/escape-too-big.out
    A tests/qapi-schema/escape-too-short.err
    A tests/qapi-schema/escape-too-short.exit
    A tests/qapi-schema/escape-too-short.json
    A tests/qapi-schema/escape-too-short.out
    M tests/qapi-schema/ident-with-escape.err
    M tests/qapi-schema/ident-with-escape.exit
    M tests/qapi-schema/ident-with-escape.json
    M tests/qapi-schema/ident-with-escape.out
    A tests/qapi-schema/unicode-str.err
    A tests/qapi-schema/unicode-str.exit
    A tests/qapi-schema/unicode-str.json
    A tests/qapi-schema/unicode-str.out
    A tests/qapi-schema/unknown-escape.err
    A tests/qapi-schema/unknown-escape.exit
    A tests/qapi-schema/unknown-escape.json
    A tests/qapi-schema/unknown-escape.out

  Log Message:
  -----------
  qapi: Support (subset of) \u escapes in strings

The handling of \ inside QAPI strings was less than ideal, and
really only worked JSON's \/, \\, \", and our extension of \'
(an obvious extension, when you realize we use '' instead of ""
for strings).  For other things, like '\n', it resulted in a
literal 'n' instead of a newline.

Of course, at the moment, we really have no use for escaped
characters, as QAPI has to map to C identifiers, and we currently
support ASCII only for that.  But down the road, we may add
support for default values for string parameters to a command
or struct; if that happens, it would be nice to correctly support
all JSON escape sequences, such as \n or \uXXXX.  This gets us
closer, by supporting Unicode escapes in the ASCII range.

Since JSON does not require \OCTAL or \xXX escapes, and our QMP
implementation does not understand them either, I intentionally
reject it here, but it would be an easy addition if we desired it.
Likewise, intentionally refusing the NUL byte means we don't have
to worry about C strings being shorter than the qapi input.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: ff55d72eaf9628e7d58e7b067b361cdbf789c9f4
      
https://github.com/qemu/qemu/commit/ff55d72eaf9628e7d58e7b067b361cdbf789c9f4
  Author: Eric Blake <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M scripts/qapi.py
    M tests/Makefile
    M tests/qapi-schema/flat-union-branch-clash.err
    M tests/qapi-schema/flat-union-branch-clash.exit
    M tests/qapi-schema/flat-union-branch-clash.json
    M tests/qapi-schema/flat-union-branch-clash.out
    A tests/qapi-schema/struct-base-clash-deep.err
    A tests/qapi-schema/struct-base-clash-deep.exit
    A tests/qapi-schema/struct-base-clash-deep.json
    A tests/qapi-schema/struct-base-clash-deep.out
    A tests/qapi-schema/struct-base-clash.err
    A tests/qapi-schema/struct-base-clash.exit
    A tests/qapi-schema/struct-base-clash.json
    A tests/qapi-schema/struct-base-clash.out

  Log Message:
  -----------
  qapi: Check for member name conflicts with a base class

Our type inheritance for both 'struct' and for flat 'union' merges
key/value pairs from the base class with those from the type in
question.  Although the C code currently boxes things so that there
is a distinction between which member is referred to, the QMP wire
format does not allow passing a key more than once in a single
object.  Besides, if we ever change the generated C code to not be
quite so boxy, we'd want to avoid duplicate member names there,
too.

Fix a testsuite entry added in an earlier patch, as well as adding
a couple more tests to ensure we have appropriate coverage.  Ensure
that collisions are detected, regardless of whether there is a
difference in opinion on whether the member name is optional.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 233353ec93e4541fa7ab1c53a922a6d5c2bfce7a
      
https://github.com/qemu/qemu/commit/233353ec93e4541fa7ab1c53a922a6d5c2bfce7a
  Author: Peter Maydell <address@hidden>
  Date:   2015-05-05 (Tue, 05 May 2015)

  Changed paths:
    M docs/qapi-code-gen.txt
    M docs/qmp/qmp-spec.txt
    M hmp.c
    M hw/pci/pci.c
    M qapi-schema.json
    M qapi/block-core.json
    M qapi/block.json
    M qapi/common.json
    M qapi/trace.json
    M qga/qapi-schema.json
    M qmp.c
    M scripts/qapi-commands.py
    M scripts/qapi-event.py
    M scripts/qapi-types.py
    M scripts/qapi-visit.py
    M scripts/qapi.py
    M tests/Makefile
    A tests/qapi-schema/alternate-array.err
    A tests/qapi-schema/alternate-array.exit
    A tests/qapi-schema/alternate-array.json
    A tests/qapi-schema/alternate-array.out
    A tests/qapi-schema/alternate-base.err
    A tests/qapi-schema/alternate-base.exit
    A tests/qapi-schema/alternate-base.json
    A tests/qapi-schema/alternate-base.out
    A tests/qapi-schema/alternate-clash.err
    A tests/qapi-schema/alternate-clash.exit
    A tests/qapi-schema/alternate-clash.json
    A tests/qapi-schema/alternate-clash.out
    A tests/qapi-schema/alternate-conflict-dict.err
    A tests/qapi-schema/alternate-conflict-dict.exit
    A tests/qapi-schema/alternate-conflict-dict.json
    A tests/qapi-schema/alternate-conflict-dict.out
    A tests/qapi-schema/alternate-conflict-string.err
    A tests/qapi-schema/alternate-conflict-string.exit
    A tests/qapi-schema/alternate-conflict-string.json
    A tests/qapi-schema/alternate-conflict-string.out
    A tests/qapi-schema/alternate-good.err
    A tests/qapi-schema/alternate-good.exit
    A tests/qapi-schema/alternate-good.json
    A tests/qapi-schema/alternate-good.out
    A tests/qapi-schema/alternate-nested.err
    A tests/qapi-schema/alternate-nested.exit
    A tests/qapi-schema/alternate-nested.json
    A tests/qapi-schema/alternate-nested.out
    A tests/qapi-schema/alternate-unknown.err
    A tests/qapi-schema/alternate-unknown.exit
    A tests/qapi-schema/alternate-unknown.json
    A tests/qapi-schema/alternate-unknown.out
    A tests/qapi-schema/bad-base.err
    A tests/qapi-schema/bad-base.exit
    A tests/qapi-schema/bad-base.json
    A tests/qapi-schema/bad-base.out
    A tests/qapi-schema/bad-data.err
    A tests/qapi-schema/bad-data.exit
    A tests/qapi-schema/bad-data.json
    A tests/qapi-schema/bad-data.out
    A tests/qapi-schema/bad-ident.err
    A tests/qapi-schema/bad-ident.exit
    A tests/qapi-schema/bad-ident.json
    A tests/qapi-schema/bad-ident.out
    A tests/qapi-schema/bad-type-bool.err
    A tests/qapi-schema/bad-type-bool.exit
    A tests/qapi-schema/bad-type-bool.json
    A tests/qapi-schema/bad-type-bool.out
    A tests/qapi-schema/bad-type-dict.err
    A tests/qapi-schema/bad-type-dict.exit
    A tests/qapi-schema/bad-type-dict.json
    A tests/qapi-schema/bad-type-dict.out
    A tests/qapi-schema/bad-type-int.err
    A tests/qapi-schema/bad-type-int.exit
    A tests/qapi-schema/bad-type-int.json
    A tests/qapi-schema/bad-type-int.out
    A tests/qapi-schema/command-int.err
    A tests/qapi-schema/command-int.exit
    A tests/qapi-schema/command-int.json
    A tests/qapi-schema/command-int.out
    A tests/qapi-schema/data-array-empty.err
    A tests/qapi-schema/data-array-empty.exit
    A tests/qapi-schema/data-array-empty.json
    A tests/qapi-schema/data-array-empty.out
    A tests/qapi-schema/data-array-unknown.err
    A tests/qapi-schema/data-array-unknown.exit
    A tests/qapi-schema/data-array-unknown.json
    A tests/qapi-schema/data-array-unknown.out
    A tests/qapi-schema/data-int.err
    A tests/qapi-schema/data-int.exit
    A tests/qapi-schema/data-int.json
    A tests/qapi-schema/data-int.out
    A tests/qapi-schema/data-member-array-bad.err
    A tests/qapi-schema/data-member-array-bad.exit
    A tests/qapi-schema/data-member-array-bad.json
    A tests/qapi-schema/data-member-array-bad.out
    A tests/qapi-schema/data-member-array.err
    A tests/qapi-schema/data-member-array.exit
    A tests/qapi-schema/data-member-array.json
    A tests/qapi-schema/data-member-array.out
    A tests/qapi-schema/data-member-unknown.err
    A tests/qapi-schema/data-member-unknown.exit
    A tests/qapi-schema/data-member-unknown.json
    A tests/qapi-schema/data-member-unknown.out
    A tests/qapi-schema/data-unknown.err
    A tests/qapi-schema/data-unknown.exit
    A tests/qapi-schema/data-unknown.json
    A tests/qapi-schema/data-unknown.out
    A tests/qapi-schema/double-data.err
    A tests/qapi-schema/double-data.exit
    A tests/qapi-schema/double-data.json
    A tests/qapi-schema/double-data.out
    A tests/qapi-schema/double-type.err
    A tests/qapi-schema/double-type.exit
    A tests/qapi-schema/double-type.json
    A tests/qapi-schema/double-type.out
    A tests/qapi-schema/enum-bad-name.err
    A tests/qapi-schema/enum-bad-name.exit
    A tests/qapi-schema/enum-bad-name.json
    A tests/qapi-schema/enum-bad-name.out
    A tests/qapi-schema/enum-clash-member.err
    A tests/qapi-schema/enum-clash-member.exit
    A tests/qapi-schema/enum-clash-member.json
    A tests/qapi-schema/enum-clash-member.out
    A tests/qapi-schema/enum-dict-member.err
    A tests/qapi-schema/enum-dict-member.exit
    A tests/qapi-schema/enum-dict-member.json
    A tests/qapi-schema/enum-dict-member.out
    A tests/qapi-schema/enum-empty.err
    A tests/qapi-schema/enum-empty.exit
    A tests/qapi-schema/enum-empty.json
    A tests/qapi-schema/enum-empty.out
    A tests/qapi-schema/enum-int-member.err
    A tests/qapi-schema/enum-int-member.exit
    A tests/qapi-schema/enum-int-member.json
    A tests/qapi-schema/enum-int-member.out
    A tests/qapi-schema/enum-max-member.err
    A tests/qapi-schema/enum-max-member.exit
    A tests/qapi-schema/enum-max-member.json
    A tests/qapi-schema/enum-max-member.out
    A tests/qapi-schema/enum-missing-data.err
    A tests/qapi-schema/enum-missing-data.exit
    A tests/qapi-schema/enum-missing-data.json
    A tests/qapi-schema/enum-missing-data.out
    A tests/qapi-schema/enum-union-clash.err
    A tests/qapi-schema/enum-union-clash.exit
    A tests/qapi-schema/enum-union-clash.json
    A tests/qapi-schema/enum-union-clash.out
    A tests/qapi-schema/enum-wrong-data.err
    A tests/qapi-schema/enum-wrong-data.exit
    A tests/qapi-schema/enum-wrong-data.json
    A tests/qapi-schema/enum-wrong-data.out
    A tests/qapi-schema/escape-outside-string.err
    A tests/qapi-schema/escape-outside-string.exit
    A tests/qapi-schema/escape-outside-string.json
    A tests/qapi-schema/escape-outside-string.out
    A tests/qapi-schema/escape-too-big.err
    A tests/qapi-schema/escape-too-big.exit
    A tests/qapi-schema/escape-too-big.json
    A tests/qapi-schema/escape-too-big.out
    A tests/qapi-schema/escape-too-short.err
    A tests/qapi-schema/escape-too-short.exit
    A tests/qapi-schema/escape-too-short.json
    A tests/qapi-schema/escape-too-short.out
    A tests/qapi-schema/event-case.err
    A tests/qapi-schema/event-case.exit
    A tests/qapi-schema/event-case.json
    A tests/qapi-schema/event-case.out
    A tests/qapi-schema/event-max.err
    A tests/qapi-schema/event-max.exit
    A tests/qapi-schema/event-max.json
    A tests/qapi-schema/event-max.out
    M tests/qapi-schema/event-nest-struct.err
    A tests/qapi-schema/flat-union-bad-base.err
    A tests/qapi-schema/flat-union-bad-base.exit
    A tests/qapi-schema/flat-union-bad-base.json
    A tests/qapi-schema/flat-union-bad-base.out
    A tests/qapi-schema/flat-union-bad-discriminator.err
    A tests/qapi-schema/flat-union-bad-discriminator.exit
    A tests/qapi-schema/flat-union-bad-discriminator.json
    A tests/qapi-schema/flat-union-bad-discriminator.out
    A tests/qapi-schema/flat-union-base-star.err
    A tests/qapi-schema/flat-union-base-star.exit
    A tests/qapi-schema/flat-union-base-star.json
    A tests/qapi-schema/flat-union-base-star.out
    A tests/qapi-schema/flat-union-base-union.err
    A tests/qapi-schema/flat-union-base-union.exit
    A tests/qapi-schema/flat-union-base-union.json
    A tests/qapi-schema/flat-union-base-union.out
    A tests/qapi-schema/flat-union-branch-clash.err
    A tests/qapi-schema/flat-union-branch-clash.exit
    A tests/qapi-schema/flat-union-branch-clash.json
    A tests/qapi-schema/flat-union-branch-clash.out
    A tests/qapi-schema/flat-union-inline.err
    A tests/qapi-schema/flat-union-inline.exit
    A tests/qapi-schema/flat-union-inline.json
    A tests/qapi-schema/flat-union-inline.out
    A tests/qapi-schema/flat-union-int-branch.err
    A tests/qapi-schema/flat-union-int-branch.exit
    A tests/qapi-schema/flat-union-int-branch.json
    A tests/qapi-schema/flat-union-int-branch.out
    M tests/qapi-schema/flat-union-invalid-branch-key.json
    M tests/qapi-schema/flat-union-invalid-discriminator.err
    M tests/qapi-schema/flat-union-invalid-discriminator.json
    M tests/qapi-schema/flat-union-no-base.err
    M tests/qapi-schema/flat-union-no-base.json
    A tests/qapi-schema/flat-union-optional-discriminator.err
    A tests/qapi-schema/flat-union-optional-discriminator.exit
    A tests/qapi-schema/flat-union-optional-discriminator.json
    A tests/qapi-schema/flat-union-optional-discriminator.out
    M tests/qapi-schema/flat-union-reverse-define.json
    M tests/qapi-schema/flat-union-reverse-define.out
    M tests/qapi-schema/flat-union-string-discriminator.json
    A tests/qapi-schema/ident-with-escape.err
    A tests/qapi-schema/ident-with-escape.exit
    A tests/qapi-schema/ident-with-escape.json
    A tests/qapi-schema/ident-with-escape.out
    M tests/qapi-schema/indented-expr.json
    M tests/qapi-schema/indented-expr.out
    A tests/qapi-schema/missing-type.err
    A tests/qapi-schema/missing-type.exit
    A tests/qapi-schema/missing-type.json
    A tests/qapi-schema/missing-type.out
    A tests/qapi-schema/nested-struct-data.err
    A tests/qapi-schema/nested-struct-data.exit
    A tests/qapi-schema/nested-struct-data.json
    A tests/qapi-schema/nested-struct-data.out
    A tests/qapi-schema/nested-struct-returns.err
    A tests/qapi-schema/nested-struct-returns.exit
    A tests/qapi-schema/nested-struct-returns.json
    A tests/qapi-schema/nested-struct-returns.out
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    A tests/qapi-schema/redefined-builtin.err
    A tests/qapi-schema/redefined-builtin.exit
    A tests/qapi-schema/redefined-builtin.json
    A tests/qapi-schema/redefined-builtin.out
    A tests/qapi-schema/redefined-command.err
    A tests/qapi-schema/redefined-command.exit
    A tests/qapi-schema/redefined-command.json
    A tests/qapi-schema/redefined-command.out
    A tests/qapi-schema/redefined-event.err
    A tests/qapi-schema/redefined-event.exit
    A tests/qapi-schema/redefined-event.json
    A tests/qapi-schema/redefined-event.out
    A tests/qapi-schema/redefined-type.err
    A tests/qapi-schema/redefined-type.exit
    A tests/qapi-schema/redefined-type.json
    A tests/qapi-schema/redefined-type.out
    A tests/qapi-schema/returns-alternate.err
    A tests/qapi-schema/returns-alternate.exit
    A tests/qapi-schema/returns-alternate.json
    A tests/qapi-schema/returns-alternate.out
    A tests/qapi-schema/returns-array-bad.err
    A tests/qapi-schema/returns-array-bad.exit
    A tests/qapi-schema/returns-array-bad.json
    A tests/qapi-schema/returns-array-bad.out
    A tests/qapi-schema/returns-int.err
    A tests/qapi-schema/returns-int.exit
    A tests/qapi-schema/returns-int.json
    A tests/qapi-schema/returns-int.out
    A tests/qapi-schema/returns-unknown.err
    A tests/qapi-schema/returns-unknown.exit
    A tests/qapi-schema/returns-unknown.json
    A tests/qapi-schema/returns-unknown.out
    A tests/qapi-schema/returns-whitelist.err
    A tests/qapi-schema/returns-whitelist.exit
    A tests/qapi-schema/returns-whitelist.json
    A tests/qapi-schema/returns-whitelist.out
    A tests/qapi-schema/struct-base-clash-deep.err
    A tests/qapi-schema/struct-base-clash-deep.exit
    A tests/qapi-schema/struct-base-clash-deep.json
    A tests/qapi-schema/struct-base-clash-deep.out
    A tests/qapi-schema/struct-base-clash.err
    A tests/qapi-schema/struct-base-clash.exit
    A tests/qapi-schema/struct-base-clash.json
    A tests/qapi-schema/struct-base-clash.out
    A tests/qapi-schema/type-bypass-bad-gen.err
    A tests/qapi-schema/type-bypass-bad-gen.exit
    A tests/qapi-schema/type-bypass-bad-gen.json
    A tests/qapi-schema/type-bypass-bad-gen.out
    A tests/qapi-schema/type-bypass-no-gen.err
    A tests/qapi-schema/type-bypass-no-gen.exit
    A tests/qapi-schema/type-bypass-no-gen.json
    A tests/qapi-schema/type-bypass-no-gen.out
    A tests/qapi-schema/type-bypass.err
    A tests/qapi-schema/type-bypass.exit
    A tests/qapi-schema/type-bypass.json
    A tests/qapi-schema/type-bypass.out
    A tests/qapi-schema/unicode-str.err
    A tests/qapi-schema/unicode-str.exit
    A tests/qapi-schema/unicode-str.json
    A tests/qapi-schema/unicode-str.out
    A tests/qapi-schema/union-bad-branch.err
    A tests/qapi-schema/union-bad-branch.exit
    A tests/qapi-schema/union-bad-branch.json
    A tests/qapi-schema/union-bad-branch.out
    A tests/qapi-schema/union-base-no-discriminator.err
    A tests/qapi-schema/union-base-no-discriminator.exit
    A tests/qapi-schema/union-base-no-discriminator.json
    A tests/qapi-schema/union-base-no-discriminator.out
    M tests/qapi-schema/union-invalid-base.err
    M tests/qapi-schema/union-invalid-base.json
    A tests/qapi-schema/union-max.err
    A tests/qapi-schema/union-max.exit
    A tests/qapi-schema/union-max.json
    A tests/qapi-schema/union-max.out
    A tests/qapi-schema/union-optional-branch.err
    A tests/qapi-schema/union-optional-branch.exit
    A tests/qapi-schema/union-optional-branch.json
    A tests/qapi-schema/union-optional-branch.out
    A tests/qapi-schema/union-unknown.err
    A tests/qapi-schema/union-unknown.exit
    A tests/qapi-schema/union-unknown.json
    A tests/qapi-schema/union-unknown.out
    A tests/qapi-schema/unknown-escape.err
    A tests/qapi-schema/unknown-escape.exit
    A tests/qapi-schema/unknown-escape.json
    A tests/qapi-schema/unknown-escape.out
    A tests/qapi-schema/unknown-expr-key.err
    A tests/qapi-schema/unknown-expr-key.exit
    A tests/qapi-schema/unknown-expr-key.json
    A tests/qapi-schema/unknown-expr-key.out
    M tests/test-qmp-commands.c
    M tests/test-qmp-input-strict.c
    M tests/test-qmp-input-visitor.c
    M tests/test-qmp-output-visitor.c
    M tests/test-visitor-serialization.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qmp-2015-05-05' into 
staging

drop qapi nested structs

# gpg: Signature made Tue May  5 17:40:40 2015 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg:                 aka "Markus Armbruster <address@hidden>"

* remotes/armbru/tags/pull-qmp-2015-05-05: (40 commits)
  qapi: Check for member name conflicts with a base class
  qapi: Support (subset of) \u escapes in strings
  qapi: Tweak doc references to QMP when QGA is also meant
  qapi: Drop dead visitor code related to nested structs
  qapi: Drop support for inline nested types
  qapi: Drop inline nested structs in query-pci
  qapi: Drop inline nested struct in query-version
  qapi: Drop tests for inline nested structs
  qapi: Merge UserDefTwo and UserDefNested in tests
  qapi: Forbid 'type' in schema
  qapi: Use 'struct' instead of 'type' in schema
  qapi: Document 'struct' metatype
  qapi: Prefer 'struct' over 'type' in generator
  qapi: More rigorous checking for type safety bypass
  qapi: Whitelist commands that don't return dictionary
  qapi: Require valid names
  qapi: More rigourous checking of types
  qapi: Add some type check tests
  qapi: Unify type bypass and add tests
  qapi: Allow true, false and null in schema json
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/874e9aeeeb74...233353ec93e4

reply via email to

[Prev in Thread] Current Thread [Next in Thread]