Hi,

I'm trying to write a rule for turning !unlikely to likely and vice versa.
However, it's hard for me to understand what is wrong with the rule and how to
make it work. Any suggestions? Do I need to introduce 'expression E;' instead
'(...)'? BTW, spatch hangs with -Dorg.

The rule:

virtual patch
virtual context
virtual org
virtual report

//----------------------------------------------------------
//  For context mode
//----------------------------------------------------------

@depends on context disable unlikely@
@@

(
* !likely(...)
|
* !unlikely(...)
)

//----------------------------------------------------------
//  For patch mode
//----------------------------------------------------------

@depends on patch disable unlikely@
@@

(
-!likely
+unlikely
 (...)
|
-!unlikely
+likely
 (...)
)

//----------------------------------------------------------
//  For org and report mode
//----------------------------------------------------------

@r depends on (org || report) disable unlikely@
position p;
@@

(
 !likely@p(...)
|
 !unlikely@p(...)
)

@script:python depends on org@
p << r.p;
@@

coccilib.org.print_todo(p[0], "WARNING use unlikely instead of !likely")

@script:python depends on report@
p << r.p;
@@

msg="WARNING: Use unlikely instead of !likely and likely instead of !unlikely"
coccilib.report.print_report(p[0], msg)

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

Reply via email to