On 24.08.2019 14:23, Julia Lawall wrote:
> 
> 
> On Sat, 24 Aug 2019, Denis Efremov wrote:
> 
>> 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.

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@

> 
> julia
> 
>>
>> 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
>>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to