Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: lars@metafoo.de (Lars-Peter Clausen)
To: cocci@systeme.lip6.fr
Subject: [Cocci] isomorphism with unlikely
Date: Mon, 20 May 2013 20:26:04 +0200	[thread overview]
Message-ID: <519A6ABC.1090004@metafoo.de> (raw)
In-Reply-To: <20130520182415.GA6975@katana>

On 05/20/2013 08:24 PM, Wolfram Sang wrote:
> 
>> There is already an isomorphism for unlikely. But it is in one direction
>> only, so 'unlikely(E)' in your cocci script will also match 'E', but 'E'
>> wont match 'unlikely(E)'.
> 
> Okay, but I would then still need 'unlikely(!r)' and 'unlikely(r ==
> NULL)' because the !r isomorphisms won't apply. I'd like to have both :)

No, just unlikley(r == NULL) also matches !r (and unlikely(!r)). This should
also work for unlikely(!r) matching unlikely(r == NULL) but for some reason
it doesn't. I just did a quick test and it looks as if even 'if(!r) ..."
doesn't match 'if(r == NULL) ...' either.

- Lars

  reply	other threads:[~2013-05-20 18:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 17:34 [Cocci] isomorphism with unlikely Wolfram Sang
2013-05-20 17:47 ` Lars-Peter Clausen
2013-05-20 18:24   ` Wolfram Sang
2013-05-20 18:26     ` Lars-Peter Clausen [this message]
2013-05-20 18:51       ` Julia Lawall
2013-05-20 19:13         ` Lars-Peter Clausen
2013-05-22 17:36           ` Julia Lawall
2013-05-26 20:01           ` Julia Lawall

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=519A6ABC.1090004@metafoo.de \
    --to=lars@metafoo.de \
    --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