On Fri, 13 Jan 2017, Guenter Roeck wrote:
> On 01/13/2017 06:24 AM, Julia Lawall wrote: > > Attached is a new version of pdev-simple.cocci. The rule m1 checks for > > the existence of a &pdev->dev and the rule m2 checks whether there already > > exists a device declaration. If the first is satisfied and the second is > > not, then the transformation is made using <... ...> rather than <+... > > ...+> which is often nore expensive. > > > > julia > > Hi Julia, > > as always, you are amazing! Both fixes work like a champ. > > I was even able to get "&pdev->dev referenced at least twice" to work with > > @m1 exists@ > identifier initfn; > identifier pdev; > type ptype.T; > position p; > @@ > > initfn@p(T *pdev, ...) { > ... > &pdev->dev > ... when any > &pdev->dev > ... when any > } This is twice in a single execution path. Twice anywhere could be done as follows: @@ position p; @@ initfn@p(T *pdev, ...) { <... &pdev@p->dev ...> } Then just inherit p into a python rule and find the number of elements in the array. julia _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci