On Thu, Oct 11, 2018 at 06:40:22PM +0200, Julia Lawall wrote: > > Sure, so if I have code like this: > > #define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm)) > > > > I want to have a rule that does: > > - #define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm)) > > + #define pte_alloc_one(mm) ((pte_t *) page_table_alloc(mm)) > > > > So far everything I tried only works for functions so I was wondering how > > one > > do this with macros. > > Maybe > > @r@ > position p; > identifier i,a,b; > @@ > > #define i(a,b)@p <+...b...+> > > @@ > position p != r.p; > identifier i,a,b; > expresssion e; > @@ > > - #define i(a,b)@p e > + #define i(a) e
So doing this gives me a parse error: parse error: File "../pte_alloc_replace.cocci", line 40, column 17, charpos = 573 around = '@', whole content = - #define i(a, b)@p e Also should that 'e' be a statement or an expression? Thanks! _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
