This seems to work pretty well.  Unfortunately, the spacing is not as nice 
as one would hope for showing off to someone else.

@@
binary operator op = {==,!=};
expression e1,e2,e3,e4,e5;
@@

(
 (e3 || e4)
|
-(
e1 op e2
-)
)
 &&
 e5

@@
binary operator op = {==,!=};
expression e1,e2,e3,e4,e5;
@@

 e5
 &&
(
 (e3 || e4)
|
-(
  e1 op e2
-)
)

-----------------------------------------------------

int main () {
  if ((a == b) && (c != d)) return 12;
  if ((a == b) && (c != d) && (c == d)) return 12;
  if (a == b && (c != d)) return 12;
  if (a == b && (c != d) && (c == d)) return 12;
  if ((a == b) && c != d) return 12;
  if ((a == b) && c != d && (c == d)) return 12;
  if ((a == b) && (c != d) && c == d) return 12;
  if ((a == b) && c != d && c == d) return 12;
  if (a == b && (c != d) && c == d) return 12;
  if ((a == b) + c) return 12;  // should not change
}

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to