[Cocci] new version

Håkon Løvdal hlovdal at gmail.com
Wed Mar 17 19:19:31 CET 2010


On 06/03/2010, Nicolas Palix <npalix at diku.dk> wrote:
> You can also add comments with either
>
>         + // comments
>
>  or
>
>     + /* comment headline
>     +     comments
>     +  */

I have some problems just adding comments. Given the following test input

int one_higher(int x)
{
        return x+1;
}

and the following smpl:

@rule0@
type T;
identifier f;
@@
+ const
T f(...)
{
...
}

@rule1@
type T;
identifier f;
@@
+/* Before function comment */
T f(...)
{
...
}

then coccinelle works like expected:

+++ /tmp/cocci-output-29833-af7f90-test.c       2010-03-17
19:13:28.000000000 +0100
@@ -1,5 +1,6 @@

-int one_higher(int x)
+/* Before function comment */
+const int one_higher(int x)
 {
        return x+1;
 }

However, if I remove rule0 and only keep rule1, then coccinelle
does not add the comment before the function.

BR Håkon Løvdal


More information about the Cocci mailing list