[Cocci] In depth docs & question about include

Julia Lawall julia.lawall at lip6.fr
Sat Dec 20 17:06:07 CET 2014


On Sat, 20 Dec 2014, Eliseo Martínez wrote:

> Hi,
>
> I discovered coccinelle some time ago, and I think it’s an amazing tool that can make a real difference.
> Unfortunately, up until now, I’ve had to restrict myself to simple use cases, because existing documentation only scratches the surface.
> You can see there are much more advanced things you could do, but for those you don’t find an explanation anywhere. You’re left with trial & error.
> So, my question is: Are there plans to produce a book-style, really in-depth explanation of all coccinelle functionality?
> I think that would be really necessary if you want bigger adoption/usage.

It's not in our current plans.

> Now, a concrete question:
> Suppose I’m introducing changes that make use of a function declared in “header.h”.
> How would I automatically insert includes for the header, only when it’s not already present?

Inserting includes is a little bit complicated, because everything has to
be attached to something.  You can try the following:

@r@
@@
#include <linux/kernel.h>

@depends on !r@
@@

#include <...>
+#include <linux/kernel.h>

julia


More information about the Cocci mailing list