On Thu, 26 Jul 2018, Timur Tabi wrote:
> On Thu, Jul 26, 2018 at 5:36 PM, Julia Lawall <[email protected]> wrote:
> >
> > The easiest thing would be to use python. You can look at
> > demos/pythontococci.cocci for an example. If you send a complete change
> > that you would like to make, I can write an example rule.
>
> My goal is to replace usage of a deprecated macro with a new one, but
> some of the parameters has changed.
>
> So
>
> DBG_PRINTF((DBG_MODULE_OS, DBG_LEVEL_ERRORS, "NVRM: error status:
> 0x%x\n", status));
>
> becomes
>
> NV_PRINTF(LEVEL_ERROR, "failed to blacklist GPU: 0x%x\n", status);
>
> So I think I've got everything except the removal of "NVRM: " from the
> beginning of any strings where the macro has been changed.
@r@
constant char[] c;
expression list[n] es;
@@
foo(es,c,...)
@script:python s@
c << r.c;
c2;
@@
coccinelle.c2 = "desired change in c with extra double quotes on the outside"
@@
expression list[r.n] r.es;
constant char[] r.c;
identifier s.c2;
@@
foo(es,
- c,
+ c2,
...)
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci