On Fri, Dec 16, 2011 at 03:24:42PM +0100, Julia Lawall wrote: > >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.
Alternatively: @@ bool x; @@ - !!x + x Or: @@ expression x; @@ - !!is_idle_task(x) + is_idle_task(x) A cleanup rule like that does seem preferable to duplicating the main rule of the patch. Still hopeful that a future version of spatch might handle the double negative for me. :) - Josh Triplett _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
