[Cocci] Multiple match versus single header result in conflicts

2018-05-04 Thread Jerome Glisse
Following semantics does not update function prototype in header file: @S@ identifier I1, I2; @@ struct myop I1 = { ..., .add = I2 , ... }; @U depends on S@ identifier S.I2; identifier A1, A2; type T1, T2; @@ int I2(T1 A1, +int c, T2 A2) { ... } run with spatch --in-place --sp-file test.spatch

Re: [Cocci] Multiple match versus single header result in conflicts

2018-05-07 Thread Jerome Glisse
On Sat, May 05, 2018 at 07:20:04AM +0200, Julia Lawall wrote: > > > On Fri, 4 May 2018, Jerome Glisse wrote: > > > Following semantics does not update function prototype in header file: > > > > @S@ > > identifier I1, I2; > > @@ > > struct myop I

Re: [Cocci] Multiple match versus single header result in conflicts

2018-05-07 Thread Jerome Glisse
On Mon, May 07, 2018 at 09:57:43PM +0200, Julia Lawall wrote: > > > On Mon, 7 May 2018, Jerome Glisse wrote: > > > On Sat, May 05, 2018 at 07:20:04AM +0200, Julia Lawall wrote: > > > > > > > > > On Fri, 4 May 2018, Jerome Glisse wrote: > > >

Re: [Cocci] Checking consequences from “exists” usage with big file name selection

2018-05-17 Thread Jerome Glisse
On Thu, May 17, 2018 at 11:11:04AM +0200, SF Markus Elfring wrote: > > Note i am in no rush, i just wanted to report this as it is likely a bug > > somewhere > > Thanks for your description of a strange software behaviour. > > How often do you work with the specification “exists” in other SmPL

Re: [Cocci] exists do not work if file group is too big

2018-05-17 Thread Jerome Glisse
On Thu, May 17, 2018 at 09:33:09AM +0200, SF Markus Elfring wrote: > > When operating on too many files the exists keyword no longer work. > > How do you think about to show a more precise error message for one approach > to add the preprocessor symbol “NULL” as the first parameter in a call > of

Re: [Cocci] Matching function pointer typedef

2018-05-16 Thread Jerome Glisse
On Tue, May 15, 2018 at 05:26:59PM -0400, Jerome Glisse wrote: > On Tue, May 15, 2018 at 10:53:36PM +0200, Julia Lawall wrote: > > > > > > On Tue, 15 May 2018, Håkon Løvdal wrote: > > > > > It's been a while since I used coccinelle, but I think to remember th

[Cocci] Matching function pointer typedef

2018-05-15 Thread Jerome Glisse
Hello, I am trying to modify an function pointer typedef something like: @@ @@ - typedef void (*toto_t)(int a, int b); + typedef void (*toto_t)(int a, int b, int c); But it seems spatch or the semantic does not handle function pointer. Or simply that typedef is not well handled in the first

Re: [Cocci] [bug] exists do not work if file group is too big (>49)

2018-05-17 Thread Jerome Glisse
On Thu, May 17, 2018 at 10:31:52PM +0200, Julia Lawall wrote: > Concretely, the problem is with LOCK_REQ, which is used as a typedef name > in cifs and as a enum constant in f2fs. > > Would there be any chance of getting rid of the LOCK_REQ typedef? > Typedefs for structure types are discouraged

Re: [Cocci] Matching function pointer typedef

2018-05-17 Thread Jerome Glisse
On Thu, May 17, 2018 at 09:28:00PM +0200, Julia Lawall wrote: > > > On Tue, 15 May 2018, Jerome Glisse wrote: > > > Hello, > > > > I am trying to modify an function pointer typedef something like: > > > > @@ > > @@ > > - typedef void (*t

Re: [Cocci] exists do not work if file group is too big

2018-05-17 Thread Jerome Glisse
On Thu, May 17, 2018 at 10:45:29PM +0200, Julia Lawall wrote: > In terms of the running time, I get a running time of 11 seconds with the > command line of 48 files and I get a running time of 22 seconds if I just > run spatch on the entire kernel. That seems slower, but if I use the > command

[Cocci] [bug] exists do not work if file group is too big (>49)

2018-05-16 Thread Jerome Glisse
When operating on too many files the exists keyword no longer work. For instance: @exists@ expression E1; @@ set_page_dirty( +NULL, E1) Using linux kernel as playground and looking at at fs/f2fs/gc.c where there is set_page_dirty() calls in nested blocks. Works: spatch --no-includes --sp-file

Re: [Cocci] [bug] exists do not work if file group is too big (>49)

2018-05-16 Thread Jerome Glisse
On Wed, May 16, 2018 at 10:02:08PM +0200, Julia Lawall wrote: > > > On Wed, 16 May 2018, Jerome Glisse wrote: > > > On Wed, May 16, 2018 at 09:37:39PM +0200, Julia Lawall wrote: > > > > > > > > > On Wed, 16 May 2018, Jerome Glisse wrote: > > &g

Re: [Cocci] [bug] exists do not work if file group is too big (>49)

2018-05-16 Thread Jerome Glisse
On Wed, May 16, 2018 at 10:20:05PM +0200, Julia Lawall wrote: > > > On Wed, 16 May 2018, Jerome Glisse wrote: > > > On Wed, May 16, 2018 at 10:02:08PM +0200, Julia Lawall wrote: > > > > > > > > > On Wed, 16 May 2018, Jerome Glisse wrote: > >

Re: [Cocci] [bug] exists do not work if file group is too big (>49)

2018-05-16 Thread Jerome Glisse
On Wed, May 16, 2018 at 10:29:30PM +0200, Julia Lawall wrote: > > [glisse@localhost ~]$ spatch --version > > spatch version 1.0.6 compiled with OCaml version 4.05.0 > > Flags passed to the configure script: --build=x86_64-redhat-linux-gnu > > --host=x86_64-redhat-linux-gnu --program-prefix= > >

Re: [Cocci] Adding a field to struct and new line issues

2019-01-12 Thread Jerome Glisse
On Sat, Jan 12, 2019 at 05:45:47PM +0100, Julia Lawall wrote: > > > On Fri, 11 Jan 2019, Jerome Glisse wrote: > > > Hi, > > > > I am trying to add a field to struct however coccinelle insist on > > adding it on the same line as struct name definition

[Cocci] Coccinelle is confuse by extern __printf macro (ie attribute)

2019-02-27 Thread Jerome Glisse
Coccinelle get confuse with kernel extern __printf macro for instance: test.c: extern __printf(3, 4) int foo(int, int, char *, ...); void toto(int, long); test.sp: @@ @@ void toto(int, +void *, long); The semantic patch will not work. But if extern is remove or if __printf macro is remove then

Re: [Cocci] Changing function pointer typedef

2019-03-08 Thread Jerome Glisse
On Fri, Mar 08, 2019 at 08:23:48PM +0100, Julia Lawall wrote: > > test.spatch > > @@ > > type T1, T2; > > @@ > > -typedef int (*filler_t)(T1, > > +typedef int (*filler_t)(T1, struct address_space *, > > If this is the whole rule, it is clear that it will not work. A semantic > patch rule has to

Re: [Cocci] Coccinelle is confuse by extern __printf macro (ie attribute)

2019-03-08 Thread Jerome Glisse
On Thu, Feb 28, 2019 at 08:05:31AM +0100, Julia Lawall wrote: > > > On Wed, 27 Feb 2019, Jerome Glisse wrote: > > > Coccinelle get confuse with kernel extern __printf macro for instance: > > > > test.c: > > extern __printf(3, 4) > > int foo(int,

[Cocci] Changing function pointer typedef

2019-03-08 Thread Jerome Glisse
Coccinelle seems to have issue with function pointer. For instance if i want to add a new argument to a function pointer typdef i need to replace the whole typedef as one line. For instance: test.c: typedef int (*filler_t)(void *, struct page *); test.spatch: @@ type T1, T2; @@ -typedef int

[Cocci] Add code after local variable declarations ?

2019-04-16 Thread Jerome Glisse
I would like to add code after local variable declaration but there is nothing particular to match there for me. Roughly i want to do: void FooFun(..., struct fooicareabout *identifier, ...) { // bunch of local variable // I want to add code here after all local variables

Re: [Cocci] Add code after local variable declarations ?

2019-04-17 Thread Jerome Glisse
On Wed, Apr 17, 2019 at 07:14:29AM +0200, Julia Lawall wrote: > > > On Tue, 16 Apr 2019, Jerome Glisse wrote: > > > I would like to add code after local variable declaration but there > > is nothing particular to match there for me. Roughly i want to do: > > &

[Cocci] Matching an expression which use an identifier

2020-05-23 Thread Jerome Glisse
Hi, I am trying to move local variable initialization of some variable to first statement. For instance in example below i want to move any local initialization that use local variable "a" to before the printf. From: void foo() { int k = 8/2; int a = 45*4; int c = 16*2; int b =