Re: [Qemu-devel] [PATCH v11 00/15] prune some QAPI visitor cruft (was qapi cleanups subset E)

2016-02-18 Thread Eric Blake
On 02/18/2016 01:08 PM, Markus Armbruster wrote:
> Eric Blake  writes:
> 
>> I'm still working on my documentation patches for QAPI visitors
>> (https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg03504.html),
>> but am finding it easier to nuke bad code up front than to document
>> that it is bad only to later nuke it. So this pulls bits and pieces
>> of other patches that Markus I have previously posted, along with
>> some new glue, to get rid of some of the worst of the cruft.
>>

> 
> Applied to qapi-next with minor tweaks.  Diff between the final
> appended.  I'd appreciate a look-over.

Looks correct to me.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v11 00/15] prune some QAPI visitor cruft (was qapi cleanups subset E)

2016-02-18 Thread Markus Armbruster
Eric Blake  writes:

> I'm still working on my documentation patches for QAPI visitors
> (https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg03504.html),
> but am finding it easier to nuke bad code up front than to document
> that it is bad only to later nuke it. So this pulls bits and pieces
> of other patches that Markus I have previously posted, along with
> some new glue, to get rid of some of the worst of the cruft.
>
> v10 was here:
> https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg03282.html
>
> Since then, I've folded in fixes for Markus' review comments,
> including rearranging some hunks and retitling some patches,
> and dropping the attempt to minimize generated gotos. The biggest
> changes are moving where variants get visited (during
> visit_type_FOO_fields() rather than visit_type_FOO()), dropping
> visit_type_alternate_FOO() (open-coding it during
> gen_visit_alternate()), and fixing bugs (properly handle
> visit_start_union() so that there are no bisection points where
> we are handling 'void *data' incorrectly).
>
> 001/15:[] [--] 'qapi: Simplify excess input reporting in input visitors'
> 002/15:[] [--] 'qapi: Forbid empty unions and useless alternates'
> 003/15:[down] 'qapi: Forbid 'any' inside an alternate'
> 004/15:[down] 'qapi: Add tests of complex objects within alternate'
> 005/15:[] [--] 'qapi-visit: Simplify how we visit common union members'
> 006/15:[down] 'qapi: Visit variants in visit_type_FOO_fields()'
> 007/15:[0051] [FC] 'qapi-visit: Unify struct and union visit'
> 008/15:[0012] [FC] 'qapi-visit: Less indirection in visit_type_Foo_fields()'
> 009/15:[0002] [FC] 'qapi: Adjust layout of FooList types'
> 010/15:[0004] [FC] 'qapi: Emit structs used as variants in topological order'
> 011/15:[down] 'qapi-visit: Use common idiom in gen_visit_fields_decl()'
> 012/15:[0148] [FC] 'qapi: Don't box struct branch of alternate'
> 013/15:[0074] [FC] 'qapi: Don't box branches of flat unions'
> 014/15:[down] 'qapi: Delete visit_start_union(), gen_visit_implicit_struct()'
> 015/15:[0001] [FC] 'qapi: Change visit_start_implicit_struct to 
> visit_start_alternate'

Applied to qapi-next with minor tweaks.  Diff between the final
appended.  I'd appreciate a look-over.

Thanks!

--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -41,7 +41,7 @@ static void visit_type_%(c_type)s_fields(Visitor *v, 
%(c_type)s *obj, Error **er
  c_type=typ.c_name())
 
 
-def gen_visit_struct_fields(name, base, members, variants=None):
+def gen_visit_struct_fields(name, base, members, variants):
 ret = ''
 
 if base:



Re: [Qemu-devel] [PATCH v11 00/15] prune some QAPI visitor cruft (was qapi cleanups subset E)

2016-02-18 Thread Eric Blake
On 02/18/2016 03:09 AM, Markus Armbruster wrote:
> Eric Blake  writes:
> 
>> I'm still working on my documentation patches for QAPI visitors
>> (https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg03504.html),
>> but am finding it easier to nuke bad code up front than to document
>> that it is bad only to later nuke it. So this pulls bits and pieces
>> of other patches that Markus I have previously posted, along with
>> some new glue, to get rid of some of the worst of the cruft.
> 
> Based on my qapi-next commit fb8a18d.  Try to remember mentioning a base
> other than current master in the future :)

Oops, yeah. The perils of sending a series at 11:30 pm, when I'm tired :(

Also available as a tag at this location:
git fetch git://repo.or.cz/qemu/ericb.git qapi-cleanupv11e

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v11 00/15] prune some QAPI visitor cruft (was qapi cleanups subset E)

2016-02-18 Thread Markus Armbruster
Eric Blake  writes:

> I'm still working on my documentation patches for QAPI visitors
> (https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg03504.html),
> but am finding it easier to nuke bad code up front than to document
> that it is bad only to later nuke it. So this pulls bits and pieces
> of other patches that Markus I have previously posted, along with
> some new glue, to get rid of some of the worst of the cruft.

Based on my qapi-next commit fb8a18d.  Try to remember mentioning a base
other than current master in the future :)

[...]



[Qemu-devel] [PATCH v11 00/15] prune some QAPI visitor cruft (was qapi cleanups subset E)

2016-02-17 Thread Eric Blake
I'm still working on my documentation patches for QAPI visitors
(https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg03504.html),
but am finding it easier to nuke bad code up front than to document
that it is bad only to later nuke it. So this pulls bits and pieces
of other patches that Markus I have previously posted, along with
some new glue, to get rid of some of the worst of the cruft.

v10 was here:
https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg03282.html

Since then, I've folded in fixes for Markus' review comments,
including rearranging some hunks and retitling some patches,
and dropping the attempt to minimize generated gotos. The biggest
changes are moving where variants get visited (during
visit_type_FOO_fields() rather than visit_type_FOO()), dropping
visit_type_alternate_FOO() (open-coding it during
gen_visit_alternate()), and fixing bugs (properly handle
visit_start_union() so that there are no bisection points where
we are handling 'void *data' incorrectly).

001/15:[] [--] 'qapi: Simplify excess input reporting in input visitors'
002/15:[] [--] 'qapi: Forbid empty unions and useless alternates'
003/15:[down] 'qapi: Forbid 'any' inside an alternate'
004/15:[down] 'qapi: Add tests of complex objects within alternate'
005/15:[] [--] 'qapi-visit: Simplify how we visit common union members'
006/15:[down] 'qapi: Visit variants in visit_type_FOO_fields()'
007/15:[0051] [FC] 'qapi-visit: Unify struct and union visit'
008/15:[0012] [FC] 'qapi-visit: Less indirection in visit_type_Foo_fields()'
009/15:[0002] [FC] 'qapi: Adjust layout of FooList types'
010/15:[0004] [FC] 'qapi: Emit structs used as variants in topological order'
011/15:[down] 'qapi-visit: Use common idiom in gen_visit_fields_decl()'
012/15:[0148] [FC] 'qapi: Don't box struct branch of alternate'
013/15:[0074] [FC] 'qapi: Don't box branches of flat unions'
014/15:[down] 'qapi: Delete visit_start_union(), gen_visit_implicit_struct()'
015/15:[0001] [FC] 'qapi: Change visit_start_implicit_struct to 
visit_start_alternate'

Eric Blake (13):
  qapi: Simplify excess input reporting in input visitors
  qapi: Forbid empty unions and useless alternates
  qapi: Forbid 'any' inside an alternate
  qapi: Add tests of complex objects within alternate
  qapi: Visit variants in visit_type_FOO_fields()
  qapi-visit: Less indirection in visit_type_Foo_fields()
  qapi: Adjust layout of FooList types
  qapi: Emit structs used as variants in topological order
  qapi-visit: Use common idiom in gen_visit_fields_decl()
  qapi: Don't box struct branch of alternate
  qapi: Don't box branches of flat unions
  qapi: Delete visit_start_union(), gen_visit_implicit_struct()
  qapi: Change visit_start_implicit_struct to visit_start_alternate

Markus Armbruster (2):
  qapi-visit: Simplify how we visit common union members
  qapi-visit: Unify struct and union visit

 include/qapi/visitor.h  |  63 +---
 include/qapi/visitor-impl.h |  21 ++-
 scripts/qapi.py |  29 +++-
 scripts/qapi-types.py   |  33 +++--
 scripts/qapi-visit.py   | 254 
 qapi/qapi-visit-core.c  |  45 ++
 cpus.c  |  18 +--
 hmp.c   |  12 +-
 qapi/opts-visitor.c |  16 +-
 qapi/qapi-dealloc-visitor.c |  42 +-
 qapi/qmp-input-visitor.c|  43 +++---
 qapi/qmp-output-visitor.c   |   3 +-
 qapi/string-input-visitor.c |   4 +-
 qapi/string-output-visitor.c|   2 +-
 tests/test-qmp-input-visitor.c  |  39 -
 tests/test-qmp-output-visitor.c |  27 +++-
 docs/qapi-code-gen.txt  |  15 +-
 tests/Makefile  |   1 +
 tests/qapi-schema/alternate-any.err |   1 +
 tests/qapi-schema/alternate-any.exit|   1 +
 tests/qapi-schema/alternate-any.json|   4 +
 tests/qapi-schema/alternate-any.out |   0
 tests/qapi-schema/alternate-empty.err   |   1 +
 tests/qapi-schema/alternate-empty.exit  |   2 +-
 tests/qapi-schema/alternate-empty.json  |   2 +-
 tests/qapi-schema/alternate-empty.out   |   5 -
 tests/qapi-schema/flat-union-empty.err  |   1 +
 tests/qapi-schema/flat-union-empty.exit |   2 +-
 tests/qapi-schema/flat-union-empty.json |   2 +-
 tests/qapi-schema/flat-union-empty.out  |   9 --
 tests/qapi-schema/qapi-schema-test.json |   4 +-
 tests/qapi-schema/qapi-schema-test.out  |   4 +-
 tests/qapi-schema/union-empty.err   |   1 +
 tests/qapi-schema/union-empty.exit  |   2 +-
 tests/qapi-schema/union-empty.json  |   2 +-
 tests/qapi-schema/union-empty.out   |   6 -
 36 files changed, 347 insertions(+), 369 deletions(-)
 create mode 100644 tests/qapi-schema/alternate-any.err
 create mode 100644 tests/qapi-schema/alternate-any.exit
 create mode 100644 tests/qapi-schema/alternate-any.json
 create mode 100644 tests/qapi-schema/altern