Here is a solution that stays at the SmPL level rather than resorting to looking at the AST...
// ---------------------------------------------------------------------- // Part 1: right arguments of && @r disable paren@ position p; expression E1,E2; @@ ( E1 && (E2) | E1 && e...@p ) @@ position r.p; expression E; @@ +( e...@p +) // ---------------------------------------------------------------------- // Part 2: left arguments of && @three@ position p; expression E1,E2,E3; @@ E1 && E2 &&@p E3 @s disable paren@ position p1!=three.p; position p; expression E1,E2; @@ ( (E1) && E2 | e...@p &&@p1 E2 ) @a@ position s.p; expression E; @@ +( e...@p +) ------------------------------------------ The important point is the rule three, that ignores &&s where the left argument is another &&. julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
