The trick I normally use is to add cleanup rules at the end; sometimes
that's easier than coming up with the perfect rule that does everything.
In your case you could add a rule at the end to remove the generated
double negation.

Actually, it is a little bit dangerous, because !! can be used to convert a non boolean value to a boolean (0 or 1). But if it is restricted to a test expression, that would be OK. It should be sufficient to do:

@@
expression x;
@@

- !!x
+ x
  && ...

The && ... can disappear as part of an isomorphism, but it should remember that !!x should be part of a test expression.

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

Reply via email to