-ret = foo()
 ...
-if(ret != 0) S1 else S2

If you really don't care about either S1 or S2. But deleting S2 might be a bad idea, because that is the case where the call to foo has succeeded. You might want a rule like:

-ret = foo()
 ...
-if (ret != 0) S1 else
 S2

You might want to be sure that S1 ends in a return, possibly after a goto:

@ends_in_return@
position p;
statement S;
@@

if@p (...) { ... return ...; } else S

and then in the above rule you would put eg

-if@p (ret != 0) S1 else
 S2

where p is inherited from ends_in_return

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

Reply via email to