Rule for turning !unlikely to likely
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
Quoted 6 lines · Denis Efremov
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.
Try adding
disable unlikely
to each rule. There is an isomorphism that makes likely and unlikely optional and perhaps it causes problems.
julia
Quoted 65 lines
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)
Quoted 7 lines
Thanks,
Denis
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 11 lines · Julia Lawall
Quoted 6 lines · Denis Efremov
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.
Quoted 6 lines
Try adding
disable unlikely
to each rule. There is an isomorphism that makes likely and unlikely optional and perhaps it causes problems.
It's already added, as you could see it in the listing. :) Maybe I do it in the wrong order?
@depends on context disable unlikely@
@depends on patch disable unlikely@
@r depends on (org || report) disable unlikely@
Quoted 68 lines
julia
Quoted 65 lines
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)
Quoted 7 lines
Quoted 7 lines
Thanks,
Denis
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci