Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On 04/05/2017 06:54 AM, Paolo Bonzini wrote: > > > On 05/04/2017 11:01, Richard W.M. Jones wrote: >> On Wed, Apr 05, 2017 at 10:38:37AM +0200, Julia Lawall wrote: >>> OK, there is nothing special about g_assert_cmpint, but Coccinelle expects >>> expressions or types in function argument lists, so it gives a parse error >>> on finding an ==. >> >> I should have checked the coccinelle mailing list before asking you, >> because I see that Eric already asked this question and you answered >> it. For reference, that is here: >> >> https://systeme.lip6.fr/pipermail/cocci/2017-April/004107.html >> >> Thanks again, > > Eric, are you using the scripts/cocci-macro-file.h? > > commit 6ad978e9f40d3edfd9f4a86b4a60e3523eff08fe > Author: Paolo Bonzini> Date: Wed May 18 11:11:55 2016 +0200 > > coccinelle: add g_assert_cmp* to macro file > > This helps applying semantic patches to unit tests. > > Signed-off-by: Paolo Bonzini Didn't even realize it existed. I've updated my spatch command line accordingly. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On 05/04/2017 11:01, Richard W.M. Jones wrote: > On Wed, Apr 05, 2017 at 10:38:37AM +0200, Julia Lawall wrote: >> OK, there is nothing special about g_assert_cmpint, but Coccinelle expects >> expressions or types in function argument lists, so it gives a parse error >> on finding an ==. > > I should have checked the coccinelle mailing list before asking you, > because I see that Eric already asked this question and you answered > it. For reference, that is here: > > https://systeme.lip6.fr/pipermail/cocci/2017-April/004107.html > > Thanks again, Eric, are you using the scripts/cocci-macro-file.h? commit 6ad978e9f40d3edfd9f4a86b4a60e3523eff08fe Author: Paolo BonziniDate: Wed May 18 11:11:55 2016 +0200 coccinelle: add g_assert_cmp* to macro file This helps applying semantic patches to unit tests. Signed-off-by: Paolo Bonzini Thanks, Paolo ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On Wed, Apr 05, 2017 at 10:38:37AM +0200, Julia Lawall wrote: > OK, there is nothing special about g_assert_cmpint, but Coccinelle expects > expressions or types in function argument lists, so it gives a parse error > on finding an ==. I should have checked the coccinelle mailing list before asking you, because I see that Eric already asked this question and you answered it. For reference, that is here: https://systeme.lip6.fr/pipermail/cocci/2017-April/004107.html Thanks again, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On Wed, 5 Apr 2017, Richard W.M. Jones wrote: > On Wed, Apr 05, 2017 at 10:21:13AM +0200, Julia Lawall wrote: > > > > > > On Wed, 5 Apr 2017, Richard W.M. Jones wrote: > > > > > On Tue, Apr 04, 2017 at 05:41:08PM -0500, Eric Blake wrote: > > > > On 01/19/2017 08:38 AM, Eric Blake wrote: > > > > > On 01/19/2017 03:25 AM, Markus Armbruster wrote: > > > > >> Eric Blakewrites: > > > > >> > > > > >>> Quite a few users of qdict_put() were manually wrapping a > > > > >>> non-QObject. We can make such call-sites shorter, by providing > > > > >>> common macros to do the tedious work. Also shorten nearby > > > > >>> qdict_put_obj(,,QOBJECT()) sequences. > > > > >>> > > > > >>> Signed-off-by: Eric Blake > > > > >>> Reviewed-by: Alberto Garcia > > > > >>> > > > > >>> --- > > > > >>> > > > > >>> v2: rebase to current master > > > > >>> > > > > >>> I'm okay if you want me to break this patch into smaller pieces. > > > > >> > > > > >> I guess I'm okay with a single piece, but I'd like to know how you > > > > >> did > > > > >> the conversion. Coccinelle? Manually? > > > > > > > > > > Manual, via grepping for put_obj.*QOBJECT. I'll see if I can do the > > > > > same > > > > > under Coccinelle (at which point, committing the script will make it > > > > > easier to rerun cleanups if later code reintroduces poor usage > > > > > patterns), so maybe I have a v3 coming up. > > > > > > > > I've got a Coccinelle patch (mostly) working now - but it has one > > > > shortfall - I found places in tests/check-qdict.c that coccinelle > > > > didn't, and traced it to the fact that our use of g_assert_cmpint(expr, > > > > ==, expr) throws off the coccinelle parser so badly that it silently > > > > ignores the entire function body containing the use of that macro. > > > > > > Julia ^ is this a known issue? > > > > Yes, it's completely standard. If there is a problem parsing a top-level > > code unit, then the whole top-level code unit is ignored. > > Actually I meant about g_assert_cmpint, but this is also good to > know too. OK, there is nothing special about g_assert_cmpint, but Coccinelle expects expressions or types in function argument lists, so it gives a parse error on finding an ==. julia ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On Tue, Apr 04, 2017 at 05:41:08PM -0500, Eric Blake wrote: > On 01/19/2017 08:38 AM, Eric Blake wrote: > > On 01/19/2017 03:25 AM, Markus Armbruster wrote: > >> Eric Blakewrites: > >> > >>> Quite a few users of qdict_put() were manually wrapping a > >>> non-QObject. We can make such call-sites shorter, by providing > >>> common macros to do the tedious work. Also shorten nearby > >>> qdict_put_obj(,,QOBJECT()) sequences. > >>> > >>> Signed-off-by: Eric Blake > >>> Reviewed-by: Alberto Garcia > >>> > >>> --- > >>> > >>> v2: rebase to current master > >>> > >>> I'm okay if you want me to break this patch into smaller pieces. > >> > >> I guess I'm okay with a single piece, but I'd like to know how you did > >> the conversion. Coccinelle? Manually? > > > > Manual, via grepping for put_obj.*QOBJECT. I'll see if I can do the same > > under Coccinelle (at which point, committing the script will make it > > easier to rerun cleanups if later code reintroduces poor usage > > patterns), so maybe I have a v3 coming up. > > I've got a Coccinelle patch (mostly) working now - but it has one > shortfall - I found places in tests/check-qdict.c that coccinelle > didn't, and traced it to the fact that our use of g_assert_cmpint(expr, > ==, expr) throws off the coccinelle parser so badly that it silently > ignores the entire function body containing the use of that macro. Julia ^ is this a known issue? If Eric is using the Fedora version of coccinelle, then he would be using either 1.0.6 or 1.0.5. > v3 will be posted soon, with the best of both worlds (coccinelle > caught spots that I missed, not to mention recent code base changes; > and my manual search found the spots in tests/ that coccinelle > missed). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On Wed, Apr 05, 2017 at 10:21:13AM +0200, Julia Lawall wrote: > > > On Wed, 5 Apr 2017, Richard W.M. Jones wrote: > > > On Tue, Apr 04, 2017 at 05:41:08PM -0500, Eric Blake wrote: > > > On 01/19/2017 08:38 AM, Eric Blake wrote: > > > > On 01/19/2017 03:25 AM, Markus Armbruster wrote: > > > >> Eric Blakewrites: > > > >> > > > >>> Quite a few users of qdict_put() were manually wrapping a > > > >>> non-QObject. We can make such call-sites shorter, by providing > > > >>> common macros to do the tedious work. Also shorten nearby > > > >>> qdict_put_obj(,,QOBJECT()) sequences. > > > >>> > > > >>> Signed-off-by: Eric Blake > > > >>> Reviewed-by: Alberto Garcia > > > >>> > > > >>> --- > > > >>> > > > >>> v2: rebase to current master > > > >>> > > > >>> I'm okay if you want me to break this patch into smaller pieces. > > > >> > > > >> I guess I'm okay with a single piece, but I'd like to know how you did > > > >> the conversion. Coccinelle? Manually? > > > > > > > > Manual, via grepping for put_obj.*QOBJECT. I'll see if I can do the same > > > > under Coccinelle (at which point, committing the script will make it > > > > easier to rerun cleanups if later code reintroduces poor usage > > > > patterns), so maybe I have a v3 coming up. > > > > > > I've got a Coccinelle patch (mostly) working now - but it has one > > > shortfall - I found places in tests/check-qdict.c that coccinelle > > > didn't, and traced it to the fact that our use of g_assert_cmpint(expr, > > > ==, expr) throws off the coccinelle parser so badly that it silently > > > ignores the entire function body containing the use of that macro. > > > > Julia ^ is this a known issue? > > Yes, it's completely standard. If there is a problem parsing a top-level > code unit, then the whole top-level code unit is ignored. Actually I meant about g_assert_cmpint, but this is also good to know too. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On Wed, 5 Apr 2017, Richard W.M. Jones wrote: > On Tue, Apr 04, 2017 at 05:41:08PM -0500, Eric Blake wrote: > > On 01/19/2017 08:38 AM, Eric Blake wrote: > > > On 01/19/2017 03:25 AM, Markus Armbruster wrote: > > >> Eric Blakewrites: > > >> > > >>> Quite a few users of qdict_put() were manually wrapping a > > >>> non-QObject. We can make such call-sites shorter, by providing > > >>> common macros to do the tedious work. Also shorten nearby > > >>> qdict_put_obj(,,QOBJECT()) sequences. > > >>> > > >>> Signed-off-by: Eric Blake > > >>> Reviewed-by: Alberto Garcia > > >>> > > >>> --- > > >>> > > >>> v2: rebase to current master > > >>> > > >>> I'm okay if you want me to break this patch into smaller pieces. > > >> > > >> I guess I'm okay with a single piece, but I'd like to know how you did > > >> the conversion. Coccinelle? Manually? > > > > > > Manual, via grepping for put_obj.*QOBJECT. I'll see if I can do the same > > > under Coccinelle (at which point, committing the script will make it > > > easier to rerun cleanups if later code reintroduces poor usage > > > patterns), so maybe I have a v3 coming up. > > > > I've got a Coccinelle patch (mostly) working now - but it has one > > shortfall - I found places in tests/check-qdict.c that coccinelle > > didn't, and traced it to the fact that our use of g_assert_cmpint(expr, > > ==, expr) throws off the coccinelle parser so badly that it silently > > ignores the entire function body containing the use of that macro. > > Julia ^ is this a known issue? Yes, it's completely standard. If there is a problem parsing a top-level code unit, then the whole top-level code unit is ignored. julia > > If Eric is using the Fedora version of coccinelle, then he would be > using either 1.0.6 or 1.0.5. > > > v3 will be posted soon, with the best of both worlds (coccinelle > > caught spots that I missed, not to mention recent code base changes; > > and my manual search found the spots in tests/ that coccinelle > > missed). > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-builder quickly builds VMs from scratch > http://libguestfs.org/virt-builder.1.html > ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On 01/19/2017 08:38 AM, Eric Blake wrote: > On 01/19/2017 03:25 AM, Markus Armbruster wrote: >> Eric Blakewrites: >> >>> Quite a few users of qdict_put() were manually wrapping a >>> non-QObject. We can make such call-sites shorter, by providing >>> common macros to do the tedious work. Also shorten nearby >>> qdict_put_obj(,,QOBJECT()) sequences. >>> >>> Signed-off-by: Eric Blake >>> Reviewed-by: Alberto Garcia >>> >>> --- >>> >>> v2: rebase to current master >>> >>> I'm okay if you want me to break this patch into smaller pieces. >> >> I guess I'm okay with a single piece, but I'd like to know how you did >> the conversion. Coccinelle? Manually? > > Manual, via grepping for put_obj.*QOBJECT. I'll see if I can do the same > under Coccinelle (at which point, committing the script will make it > easier to rerun cleanups if later code reintroduces poor usage > patterns), so maybe I have a v3 coming up. I've got a Coccinelle patch (mostly) working now - but it has one shortfall - I found places in tests/check-qdict.c that coccinelle didn't, and traced it to the fact that our use of g_assert_cmpint(expr, ==, expr) throws off the coccinelle parser so badly that it silently ignores the entire function body containing the use of that macro. v3 will be posted soon, with the best of both worlds (coccinelle caught spots that I missed, not to mention recent code base changes; and my manual search found the spots in tests/ that coccinelle missed). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
On 01/19/2017 03:25 AM, Markus Armbruster wrote: > Eric Blakewrites: > >> Quite a few users of qdict_put() were manually wrapping a >> non-QObject. We can make such call-sites shorter, by providing >> common macros to do the tedious work. Also shorten nearby >> qdict_put_obj(,,QOBJECT()) sequences. >> >> Signed-off-by: Eric Blake >> Reviewed-by: Alberto Garcia >> >> --- >> >> v2: rebase to current master >> >> I'm okay if you want me to break this patch into smaller pieces. > > I guess I'm okay with a single piece, but I'd like to know how you did > the conversion. Coccinelle? Manually? Manual, via grepping for put_obj.*QOBJECT. I'll see if I can do the same under Coccinelle (at which point, committing the script will make it easier to rerun cleanups if later code reintroduces poor usage patterns), so maybe I have a v3 coming up. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [Qemu-devel] [PATCH v2 2/6] qdict: Add convenience helpers for wrapped puts
Eric Blakewrites: > Quite a few users of qdict_put() were manually wrapping a > non-QObject. We can make such call-sites shorter, by providing > common macros to do the tedious work. Also shorten nearby > qdict_put_obj(,,QOBJECT()) sequences. > > Signed-off-by: Eric Blake > Reviewed-by: Alberto Garcia > > --- > > v2: rebase to current master > > I'm okay if you want me to break this patch into smaller pieces. I guess I'm okay with a single piece, but I'd like to know how you did the conversion. Coccinelle? Manually? ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel