From: Denis Efremov <efremov@linux.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Rule for turning !unlikely to likely
Date: Sat, 24 Aug 2019 16:01:16 +0300 [thread overview]
Message-ID: <b8aea4aa-e8d0-db47-f993-e5586a451577@linux.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1908241922190.2720@hadrien>
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
>> Cocci@systeme.lip6.fr
>> https://systeme.lip6.fr/mailman/listinfo/cocci
>>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
prev parent reply other threads:[~2019-08-24 13:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-24 7:14 [Cocci] Rule for turning !unlikely to likely Denis Efremov
2019-08-24 11:23 ` Julia Lawall
2019-08-24 13:01 ` Denis Efremov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8aea4aa-e8d0-db47-f993-e5586a451577@linux.com \
--to=efremov@linux.com \
--cc=cocci@systeme.lip6.fr \
--cc=julia.lawall@lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.