> OK, if you may have more than one argument to your print, > then you can find the offset using an expression list metavariable: > > @r@ > expression list[n] between; > @@ > > print(s,between,h2->name,...) > > Then you can use r.n in your python rule to figure out where is the %s to > change.
This data processing approach sounds promising. > Unfortunately, this will not work well if there are multiple name references > in the argument list. I hope that the Coccinelle software can help more with the analysis for format strings. > Because you will be trying to change the format string in multiple ways, > eg once where between has length 2 and once where between has length 4. This can probably happen. > Substantial hacks would be required to deal with this. How can corresponding collateral evolution be better supported? > It would be nice if you could do > > @r@ > expression list[bn] between; > expression list[an] after; > position p; > @@ > print@p(s,between,name,after) > > @@ > format list[r.bn] f1; > format list[r.an] f2; > position r.p; > @@ > print@p( > - "%@f1@%s%@f2@" > + "%@f1@%m%@f2@" > , l) > > I don't know if that would work, though. I find this information interesting. How will the clarification be continued for affected open issues? Regards, Markus _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci