Josh
@@ struct task_struct *task; @@
- (task)->pid == 0
+ is_idle_task(task)
@@ struct task_struct *task; @@
- (task)->pid != 0
+ !is_idle_task(task)
You could write:
@@ struct task_struct *task; @@
- (task)->pid != 0
+ !((task)->pid == 0)
and rely on the transformed code matching the first rule.
Now of course you have an extra set of ()
On the other hand there might be a 'standard' rule that
promptly write !( == ) back to !=, have not checked.
It seems like some way should exist to only write one of those and have
coccinelle derive the other one, but I didn't manage to find it. I'd
like to avoid the redundancy if possible; any suggestions?
- Josh Triplett
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)
--
Derek M. Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd blog:shape-of-code.coding-guidelines.com
Source code analysis http://www.knosof.co.uk
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)