On 09/17/2012 11:32 AM, Wei Yongjun wrote:
> Hi all,
> 
> I have the following cocci file,
> 
> @@
> expression pos, head, len, rem;
> identifier nla_ok, nla_next;
> iterator name nla_for_each_attr;
> statement S;
> @@
> - for (pos = head, rem = len; nla_ok(pos, rem); pos = nla_next(pos, &rem))
> + nla_for_each_attr(pos, head, len, rem)
> S
> 
> But the error is output when using spatch,
> 
> Fatal error: exception Failure("minus: parse error: 
>  = File "nla_for_each_attr.cocci", line 7, column 17,  charpos = 130
>     around = ',', whole content = - for (pos = head, rem = len; nla_ok(pos, 
> rem); pos = nla_next(pos, &rem))
> ")
> 
> 
> It seems that spatch does not handle 'pos = head, rem = len' in the
> for expression.
> 
> So, does spatch support this? or my cocci file is wrong?


Are you using the latest coccinelle version? You cocci file works fine here:

 void foo(void)
 {
        int rem, pos, head, len;
-       for (pos = head, rem = len; nla_ok(pos, rem); pos = nla_next(pos, &rem))
+       nla_for_each_attr(pos, head, len, rem)
                bar();
 }

- Lars
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to