[Cocci] Replacement of function calls and corresponding parameters
julia at diku.dk
Thu Mar 11 14:00:17 CET 2010
On Thu, 11 Mar 2010, SF Markus Elfring wrote:
> > - foo(E)
> > + bar(E->x,0)
> I read this pattern in a way that variable definitions and assignments are not
> taken into account before the function call when it matches.
> > But there is no general rule for all problems. If the arguments are
> > computed in completely random ways, and the context uses the return value
> > in completely random ways, then Coccinelle is probably not very useful.
> The desired update might require data flow analysis.
Unfortunately, there is not a general answer to the question. If you want
to do something about a variable declaration and use, you can make a
pattern that has those and ... in between. You can put some constraints
on the control-flow path matched by the ... using when.
More information about the Cocci