Re: [PATCH 1/1] scripts/coccinelle/misc: add swap.cocci

2015-06-05 Thread Julia Lawall
On Fri, 5 Jun 2015, Fabian Frederick wrote: > > > > On 31 May 2015 at 11:42 Julia Lawall wrote: > > > > > > I propose the extended version below (not currently coccicheck friendly).  > > the extra features are: > > > > 1.  The original version requires i1 and i2 to be identifiers, eg x and y.  >

Re: [PATCH 1/1] scripts/coccinelle/misc: add swap.cocci

2015-06-05 Thread Fabian Frederick
> On 31 May 2015 at 11:42 Julia Lawall wrote: > > > I propose the extended version below (not currently coccicheck friendly).  > the extra features are: > > 1.  The original version requires i1 and i2 to be identifiers, eg x and y.  > This doesn't address the case where they are terms line x->a

Re: [PATCH 1/1] scripts/coccinelle/misc: add swap.cocci

2015-05-31 Thread Julia Lawall
Hmm, I do get more unused variable warnings than expected. I will have to look into it. julia On Sun, 31 May 2015, Julia Lawall wrote: > I propose the extended version below (not currently coccicheck friendly). > the extra features are: > > 1. The original version requires i1 and i2 to be

Re: [PATCH 1/1] scripts/coccinelle/misc: add swap.cocci

2015-05-31 Thread Julia Lawall
I propose the extended version below (not currently coccicheck friendly). the extra features are: 1. The original version requires i1 and i2 to be identifiers, eg x and y. This doesn't address the case where they are terms line x->a or x[b]. The fact that the original code contains assignme

[PATCH 1/1] scripts/coccinelle/misc: add swap.cocci

2015-05-19 Thread Fabian Frederick
Operations like int a, b, tmp; tmp = a; a = b; b = tmp; can be replaced by int a, b; swap(a, b); This uses kernel.h macro definition and simplifies the code. Thanks to Julia Lawall for suggestions about expressions and sgen Signed-off-by: Fabian Frederick --- scripts/coccinelle/misc/swap.