[Cocci] Moving a function body to an other source code place with SmPL

Julia Lawall julia.lawall at lip6.fr
Mon May 14 16:35:11 CEST 2018

On Mon, 14 May 2018, SF Markus Elfring wrote:

> Hello,
> I am curious on how good the Coccinelle software can support a specific
> source code transformation:
> It would be occasionally nice if an implementation of a function could be
> completely stored into a metavariable.
> Is a statement list variable appropriate for this use case?


identifier f;
statement list SS;

f() {

A statement list metavariable should only be used as the body of a block
{}.  If it is not working at the top of a function, it should be possible
to fix that.

> Can these data be moved to an other function (or macro definition)?

Yes.  A statement list variable can be added anywhere a list of statements
is allowed, ie not necessarily as the complete body of a block.


> Regards,
> Markus
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci

More information about the Cocci mailing list