On Thu, 29 Dec 2011, Artem Bityutskiy wrote:

On Thu, 2011-12-29 at 14:33 +0100, Julia Lawall wrote:
@r exists@
position p;
@@

a@p()
... when != x
b()

@@
position p;
@@

-a();
  ... when != x
?b()

Thank, but frankly, I do not understand how this patch works, I need to
read some more docs.

Actually, I messed it up rather badly...

@r exists@
position p;
@@

a@p()
... when != x
b()

@@
position r.p;
@@

-a@p();
  ... when != x
?b()

The first rule named r finds a call to a followed by a call to b with no
intervening reference to x and remembers the position of the call to a.
The second rule finds the same call to a, as indicated by the inherited
position variable p, and removes it if on every execution path there is no
x before a call to b, if any.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to