Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-08 Thread Nicholas Mc Guire
On Tue, 05 May 2015, Julia Lawall wrote: > > > On Tue, 5 May 2015, Nicholas Mc Guire wrote: > > > On Tue, 05 May 2015, Julia Lawall wrote: > > > > > > +@match@ > > > > +identifier f,ret; > > > > +position p; > > > > +type T1,T2; > > > > +@@ > > > > + > > > > +T1 f(...) { > > > > + T2 ret; > > >

[Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-06 Thread Nicholas Mc Guire
Check if the signature of a function and the return value type match. This is currently not the case in more than 2300 functions. In many cases this mismatch will have no side-effects but in some cases it may lead to hard to locate problems - and for readability and code understanding it is also he

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-06 Thread SF Markus Elfring
> +virtual context > +virtual org > +virtual report Where do you want to reuse these variables in your SmPL scripts? > +@match@ > +identifier f,ret; > +position p; > +type T1,T2; > +@@ > + > +T1 f(...) { > + T2 ret; Will it be more helpful to mark only such variable declarations where the speci

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread Julia Lawall
On Tue, 5 May 2015, SF Markus Elfring wrote: > > Then Coccinelle will find the cases where the types are wrong, rather than > > requiring a test in python. > > Do you need a minus character in the first text column of the SmPL scripts > then > to mark corresponding update candidates (instead of t

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread Julia Lawall
On Tue, 5 May 2015, Nicholas Mc Guire wrote: > On Tue, 05 May 2015, Julia Lawall wrote: > > > > +@match@ > > > +identifier f,ret; > > > +position p; > > > +type T1,T2; > > > +@@ > > > + > > > +T1 f(...) { > > > + T2 ret; > > > +<+... > > > +* return@p ret > > > +; > > > +...+> > > > +} > > > > G

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread SF Markus Elfring
> Then Coccinelle will find the cases where the types are wrong, rather than > requiring a test in python. Do you need a minus character in the first text column of the SmPL scripts then to mark corresponding update candidates (instead of the mentioned warning printing)? Regards, Markus

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread Nicholas Mc Guire
On Tue, 05 May 2015, Julia Lawall wrote: > > +@match@ > > +identifier f,ret; > > +position p; > > +type T1,T2; > > +@@ > > + > > +T1 f(...) { > > + T2 ret; > > +<+... > > +* return@p ret > > +; > > +...+> > > +} > > Given the number of results, it may seem surprising, but I think that you > are a

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread Julia Lawall
> +@match@ > +identifier f,ret; > +position p; > +type T1,T2; > +@@ > + > +T1 f(...) { > + T2 ret; > +<+... > +* return@p ret > +; > +...+> > +} Given the number of results, it may seem surprising, but I think that you are actually missing a lot of results. Becaue you require that ret be the firs

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread SF Markus Elfring
>> How do you think about to import the result list into a database table? > > working on that "re-cycling" your parameter count example > top 10: > 488 ssize_t != int > 195 int != unsigned int > 183 long != int … Would you like to provide a static source code analysis directly in su

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread Julia Lawall
On Tue, 5 May 2015, Nicholas Mc Guire wrote: > On Tue, 05 May 2015, SF Markus Elfring wrote: > > > > Check if the signature of a function and the return value type match. > > > > Is this a task that is usually performed by a compiler? > > > > > > > In many cases this mismatch will have no side-eff

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread Nicholas Mc Guire
On Tue, 05 May 2015, SF Markus Elfring wrote: > > Check if the signature of a function and the return value type match. > > Is this a task that is usually performed by a compiler? > > > > In many cases this mismatch will have no side-effects > > but in some cases it may lead to hard to locate p

Re: [Cocci] [PATCH RFC] Coccinelle: Check for return not matching function signature

2015-05-05 Thread SF Markus Elfring
> Check if the signature of a function and the return value type match. Is this a task that is usually performed by a compiler? > In many cases this mismatch will have no side-effects > but in some cases it may lead to hard to locate problems It is another software development challenge to find