On Thu, 11 Mar 2010, SF Markus Elfring wrote:

> > Could you explain more about what transformation is desired?
> 
> I describe just a general maintenance task.
> 
> I am looking for ways to replace a function "ABC" by "XYZ" with the help of 
> the
> semantic patch language. I see a difficulty in the design detail if these
> functions have got different parameters and return types.
> 
> Source code adjustments should only be performed after the existence of the 
> old
> function was detected. The passed arguments must fit to the new interface.

This is what Coccinelle is supposed to help you do.  The difficulty is 
indeed if the parameters and return types change.  In that case, you have 
to figure out what the new arguments and the new calling context should 
be, just as if you were to make the change by hand.  If there is a 
systematic way to make the adjustements, then Coccinelle can help you.  
For example, one might want to do:

@@
expression E;
@@

- foo(E)
+ bar(E->x,0)

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.  
You could do as well by grepping for the function name and changing each 
instance by hand.

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

Reply via email to