I was hoping that you could write

@@ struct task_struct *task; statement S1,S2; @@
  if (
- (task)->pid == 0
+ is_idle_task(task)
      || ...) S1 else S2

and have it do everything. Because with S1 and S2 as the then and else branches, there is an isomorphism to flip the branches while negating the test expression. Then the intention was that it would push the ! in to the ==, making it a !=. Unfortunately, though this doesn't work, because it sees the ! as part of the context and == as part of the removed code. So it works fine if you are just doing matching, but not transformation.

So I think the best solution would be to stick with the separate == and != rules.

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

Reply via email to