Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Joe Perches wrote: > On Sun, 2020-08-30 at 17:46 +0200, Julia Lawall wrote: > > The following: > > > > @not_int_not_len exists@ > > type T != int; > > identifier x != len; > > position p; > > identifier sysfs =~ "^sysfs_emit.*$"; > > assignment operator aop; > > @@ > > > >

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Joe Perches
On Sun, 2020-08-30 at 17:46 +0200, Julia Lawall wrote: > The following: > > @not_int_not_len exists@ > type T != int; > identifier x != len; > position p; > identifier sysfs =~ "^sysfs_emit.*$"; > assignment operator aop; > @@ > > T@p x; > ... > x aop sysfs(...) > > @@ > type not_int_not_len.T;

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Joe Perches
On Sun, 2020-08-30 at 17:46 +0200, Julia Lawall wrote: > [...] > > > Thanks, I used the slightly different from your suggestion > > where sysfs is an identifier with function args and a > > semicolon after the transform type, (otherwise I get cocci errors). > > like this below: > > > > But it

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
[...] > Thanks, I used the slightly different from your suggestion > where sysfs is an identifier with function args and a > semicolon after the transform type, (otherwise I get cocci errors). > like this below: > > But it doesn't work (no renaming) when there is an > initializer to the variable

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Joe Perches
On Sun, 2020-08-30 at 10:27 +0200, Julia Lawall wrote: > > On Sun, 30 Aug 2020, Joe Perches wrote: > > > On Sun, 2020-08-30 at 08:57 +0200, Julia Lawall wrote: > > > On Sat, 29 Aug 2020, Joe Perches wrote: > > > > > > > Is it me not understanding cocci grammar again? > > > > > > The problem is

Re: [Cocci] transform oddity

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Markus Elfring wrote: > >> How do you think about to use the following transformation variant? > > > > This is uselessly expensive. It is already known that there is at least > > one occurrence of x. > > Would we like to care if the affected identifier should be updated

Re: [Cocci] transform oddity

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Markus Elfring wrote: > > - T x@p; > > + int len > > <... > > - x > > + len > > ...> > > How do you think about to use the following transformation variant? This is uselessly expensive. It is already known that there is at least one occurrence of x. julia > > -T

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Joe Perches wrote: > On Sun, 2020-08-30 at 08:57 +0200, Julia Lawall wrote: > > > > On Sat, 29 Aug 2020, Joe Perches wrote: > > > > > Is it me not understanding cocci grammar again? > > > > The problem is the loop. You are trying to change something in the body > > of a

Re: [Cocci] transform oddity

2020-08-30 Thread Markus Elfring
> Is it me not understanding cocci grammar again? You are also struggling with expressing your data processing needs by the means of the semantic patch language. You would like to rename three parameters for selected functions. I imagine that an other transformation specification will be more

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Joe Perches
On Sun, 2020-08-30 at 08:57 +0200, Julia Lawall wrote: > > On Sat, 29 Aug 2020, Joe Perches wrote: > > > Is it me not understanding cocci grammar again? > > The problem is the loop. You are trying to change something in the body > of a loop and the body of a for loop might not be executed.

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
On Sat, 29 Aug 2020, Joe Perches wrote: > Is it me not understanding cocci grammar again? The problem is the loop. You are trying to change something in the body of a loop and the body of a for loop might not be executed. ... means that the thing must be found on every execution path. Do

[Cocci] transform oddity / bug ?

2020-08-30 Thread Joe Perches
Is it me not understanding cocci grammar again? Given these input and cocci script files: Why isn't the show_test1 function transformed? Why is only the show_test2 function transformed? The only difference between the files is some commented out lines with a for loop and if test. $ cat test.c