On Thu, 29 Dec 2011, Artem Bityutskiy wrote:
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;
Good idea :)
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)