3. Why "mtdchar_read3()" does not match?
Put ? on mtd_read to make it optional on some exection paths. Now that I write this, I realize that that will allow it to be optional along all execution paths. It is true that the assignment is not needed in those cases either, so perhaps it is a good thing. But if you don't want to be bother with those, you can use two rules, one to find when there exists the pattern and another to do the removal. For a more generic example: @r exists@ position p; @@ a@p() ... when != x b() @@ position p; @@ -a(); ... when != x ?b() This will only get rid of a() when it is both followed at least once by b(), with no previous use of x, and along every execution path either it is followed by b or x is not used. julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
