cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Denis Efremov <efremov@linux.com>
To: cocci@systeme.lip6.fr
Subject: [Cocci] Rule for turning !unlikely to likely
Date: Sat, 24 Aug 2019 10:14:05 +0300	[thread overview]
Message-ID: <44525ca7-a97b-0858-9131-a97459bac4b5@linux.com> (raw)

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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

             reply	other threads:[~2019-08-24  7:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-24  7:14 Denis Efremov [this message]
2019-08-24 11:23 ` [Cocci] Rule for turning !unlikely to likely Julia Lawall
2019-08-24 13:01   ` Denis Efremov

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=44525ca7-a97b-0858-9131-a97459bac4b5@linux.com \
    --to=efremov@linux.com \
    --cc=cocci@systeme.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).