When I fix the abstract equal problem, it will still crash because the
inner if is matched twice for removal. If you write the semantic patch as
follows, it will be fine:
@@
identifier e;
@@
- e = dma_set_coherent_mask(...);
- if(<+... e ...+>) {...}
@@
identifier e;
@@
- e = dma_set_mask(...);
- if(<+... e ...+>) {...}
On Fri, 15 Jun 2012, yafo lee wrote:
> Hi guys, the following rule:
> @@
> identifier e;
> identifier dma_fn =~ "dma_(set_mask|set_coherent_mask)";
> @@
> - e = dma_fn(...);
> - if(<+... e ...+>) {...}
Even if it worked, I don't think this is the best way to write the above
rule. You could say:
@@
identifier e;
@@
- e = \(dma_set_mask\|dma_set_coherent_mask\)(...);
- if(<+... e ...+>) {...}
It is shorter, more explicit about what is being changed where, and more
efficient because coccinelle will pick out only the files that reference
these two functions.
But it won't work because of the double change problem.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)