On 06/03/2010, Nicolas Palix <[email protected]> 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
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to