[Cocci] Addition of preprocessor statements with SmPL

Julia Lawall julia.lawall at lip6.fr
Wed Oct 29 12:07:17 CET 2014


On Wed, 29 Oct 2014, Jean-Sébastien Pédron wrote:

> On 29.10.2014 11:26, Julia Lawall wrote:
> >> I wanted to be able to re-run spatch on an already patched content. The
> >> use case is to add new function prototypes manually and run spatch to
> >> handle the associated #define automatically.
> >
> > I think that you could do the following:
> >
> > @r@
> > identifier func;
> > @@
> > #define        func    BAR(func)
> >
> > @s@
> > identifier r.func;
> > position p;
> > @@
> >
> > func at p(...) {...}
> >
> > @@
> > identifier func;
> > position p != s.p;
> > @@
> >
> > +#define        func    BAR(func)
> > func(...) { ... }

Sorry, typo here.  It should be func at p(...) { ... }

What is more unpleasant is that at least in my version of Coccinelle, it
indents the function definition.

julia


More information about the Cocci mailing list