[Cocci] --no-loops

2016-02-17 Thread Nicholas Mc Guire

Hi !

 --no-loops is documented as:

   --no-loops
  drop all back edges derived from looping constructs - unsafe


 the background is that some scanners will simply not make any
 progress (e.g. linux-next/lib/rbtree.c:__rb_insert() is a perfect 
 "hang" without --no-loops for even simple scanners

 what exactly does unsafe here mean ? 

thx!
hofrat
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH] scripts/coccinelle: modernize

2016-02-17 Thread Nishanth Menon
On 02/17/2016 05:16 PM, Julia Lawall wrote:
> & is no longer allowed in column 0, since Coccinelle 1.0.4.
> 
> Signed-off-by: Julia Lawall 
> 
> ---
>  scripts/coccinelle/iterators/use_after_iter.cocci |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci 
> b/scripts/coccinelle/iterators/use_after_iter.cocci
> index f085f59..ce8cc9c 100644
> --- a/scripts/coccinelle/iterators/use_after_iter.cocci
> +++ b/scripts/coccinelle/iterators/use_after_iter.cocci
> @@ -123,7 +123,7 @@ list_remove_head(x,c,...)
>  |
>  sizeof(<+...c...+>)
>  |
> ->member
> + >member
>  |
>  c = E
>  |
> 


Verified with:
spatch --version
spatch byte-code version 1.0.4-00118-gc7cf750d1c44 compiled with OCaml
version 4.01.0


Tested-by: Nishanth Menon 

-- 
Regards,
Nishanth Menon
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH] scripts/coccinelle: modernize

2016-02-17 Thread Julia Lawall
On Wed, 17 Feb 2016, Nishanth Menon wrote:

> On 02/17/2016 05:16 PM, Julia Lawall wrote:
> > & is no longer allowed in column 0, since Coccinelle 1.0.4.
> >
> > Signed-off-by: Julia Lawall 
> >
> > ---
> >  scripts/coccinelle/iterators/use_after_iter.cocci |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci 
> > b/scripts/coccinelle/iterators/use_after_iter.cocci
> > index f085f59..ce8cc9c 100644
> > --- a/scripts/coccinelle/iterators/use_after_iter.cocci
> > +++ b/scripts/coccinelle/iterators/use_after_iter.cocci
> > @@ -123,7 +123,7 @@ list_remove_head(x,c,...)
> >  |
> >  sizeof(<+...c...+>)
> >  |
> > ->member
> > + >member
> >  |
> >  c = E
> >  |
> >
>
>
> Verified with:
> spatch --version
> spatch byte-code version 1.0.4-00118-gc7cf750d1c44 compiled with OCaml
> version 4.01.0
>
>
> Tested-by: Nishanth Menon 

Thanks!

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] keeping cast affects match?

2016-02-17 Thread Julia Lawall
On Wed, 17 Feb 2016, Wolfram Sang wrote:

> > The isomorphism that allows ignoring a cast only works when the type
> > metavariable is used only once.  You uare using it twice.  The fact that
> > you wanted to add it indicates that you really want it to be there.
>
> Aha, I understand. Thank you for the explanation!
>
> > I think that everything should be fine if you just move the (T) out of the
> > removed and added code.
>
> Much better! I still fall for thinking too much in terms of 'lines'
> instead of 'tokens'. Prompt and proper response (again) much
> appreciated. Thank you a ton!

It's worth thinking twice if you find yourself removing something to add
it back.  Sometimes it's just more convenient, or even useful, because
Coccinelle is pretty good now at inserting newlines in the right place for
long argument lists, but when it is at one end or another of the pattern
like this, it can be better to just pull the common part out into the
context.

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] keeping cast affects match?

2016-02-17 Thread Wolfram Sang
> The isomorphism that allows ignoring a cast only works when the type
> metavariable is used only once.  You uare using it twice.  The fact that
> you wanted to add it indicates that you really want it to be there.

Aha, I understand. Thank you for the explanation!

> I think that everything should be fine if you just move the (T) out of the
> removed and added code.

Much better! I still fall for thinking too much in terms of 'lines'
instead of 'tokens'. Prompt and proper response (again) much
appreciated. Thank you a ton!

   Wolfram



signature.asc
Description: PGP signature
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] keeping cast affects match?

2016-02-17 Thread Wolfram Sang
Hi,

using Coccinelle v1.04 from Debian:

$ spatch -version
spatch version 1.0.4 with Python support and with PCRE support

The following semantic patch produces a match with current linux-next:

@@
expression table, dev;
type T;
@@
-   (T)of_match_device(table, dev)->data
+   of_device_get_match_data(dev)


$ spatch -sp_file minimal.cocci drivers/gpu/drm/rcar-du/
...
HANDLING: drivers/gpu/drm/rcar-du/rcar_du_drv.c
diff = 
diff -u -p a/rcar_du_drv.c b/rcar_du_drv.c
--- a/rcar_du_drv.c
+++ b/rcar_du_drv.c
@@ -183,7 +183,7 @@ static int rcar_du_load(struct drm_devic
init_waitqueue_head(>commit.wait);
 
rcdu->dev = >dev;
-   rcdu->info = of_match_device(rcar_du_of_table, rcdu->dev)->data;
+   rcdu->info = of_device_get_match_data(rcdu->dev);
rcdu->ddev = dev;
dev->dev_private = rcdu;

However, the match goes away when I want to keep a potential cast (T) which I
need in other places:

@@
expression table, dev;
type T;
@@
-   (T)of_match_device(table, dev)->data
+   (T)of_device_get_match_data(dev)

I wonder why adding (T) to "+" affects the matching. Is this a bug or do I miss
something?

Thanks,

   Wolfram



signature.asc
Description: PGP signature
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Red Hat Women in open source award

2016-02-17 Thread Vaishali Thakkar


On Wednesday 17 February 2016 06:17 PM, Derek M Jones wrote:
> Julia,
>
>> If you care to put in a vote for me/Coccinelle...
>
> I would be happy to vote for you, but do you really
> want to win this?
>
> The women on the academic side are all students and
> yours is the only name I recognise on the community list.
>

I think Community and Academic awards are different. Julia is
in competition with Valeria Aurora, Jessica Mckellar, Heidi Hills
and Carrie Anne Philbin. 

>> https://www.redhat.com/en/about/women-in-open-source
>>
>> julia
>> ___
>> Cocci mailing list
>> Cocci@systeme.lip6.fr
>> https://systeme.lip6.fr/mailman/listinfo/cocci
>>
>

-- 
Vaishali

___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Red Hat Women in open source award

2016-02-17 Thread Derek M Jones

Julia,


If you care to put in a vote for me/Coccinelle...


I would be happy to vote for you, but do you really
want to win this?

The women on the academic side are all students and
yours is the only name I recognise on the community list.


https://www.redhat.com/en/about/women-in-open-source

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci



--
Derek M. Jones   Software analysis
tel: +44 (0)1252 520667  blog:shape-of-code.coding-guidelines.com
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci