Ok, thanks, good to know. "... when exists" does solve the issue.
However, I want to also have the "!= retlen" constraint, and coccinelle
does not seem to combine both "exists" and "!= retlen".

You could have it.  You just need a separate when for each thing:

... when exists
    when != retlen

But it is not a good solution in your case, because it will happily match eg

retlen = 0;
if (x)
  mtd_read(&retlen);
else
  retlen = retlen + 1;

Because there does exist a path from retlen = 0 to a call to mtd_read.

julia

So I ended
up with the "?" sign as Julia and Lars-Peter have suggested:

@@
identifier retlen;
@@
- retlen = 0;
... when != retlen
?mtd_read(&retlen)

Thanks!

--
Best Regards,
Artem Bityutskiy

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

Reply via email to