On Thu, 2011-12-29 at 14:27 +0100, Julia Lawall wrote:
> The former unfortunately doesn't work for cases where multiple variables 
> are declared at once.  You may want to make two rules, one to do the 
> transformation as above, and another just to find such problematic cases, 
> with retlen = 0 and no semicolon.

Yes, thanks. I've found this wiki page:
http://cocci.ekstranet.diku.dk/wiki/doku.php?id=more_that_one_variable_in_decl_error

and ended up, including suggestions from Lars-Peter about "not only
zero", with this:

@@
identifier retlen;
constant C;
@@      
(
- retlen = C;
|
int
-retlen = C 
+ retlen
;
)       
... when != retlen
?mtd_read(&retlen)

I've tested it on an example with "int w, retlen = 0, u", and it works:

-       int retlen = 0, u;
+       int retlen, u;

Thanks you!

-- 
Best Regards,
Artem Bityutskiy

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to