Coccinelle archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: cocci@inria.fr
Subject: [cocci] "not supported"
Date: Wed, 19 Oct 2022 22:56:15 -0600	[thread overview]
Message-ID: <CAHmME9rTWvUxsM-sFZh1r+D5gb-8rbHmeWiFEfobkjxDRrZO1Q@mail.gmail.com> (raw)

Hi,

I'm trying to generically replace constructions that look like this:

@@
expression E;
type T;
identifier I;
@@
  {
-   T I;
-   do {
-     I = get_random_u32();
-   } while (I > E);
-   return I;
+   return get_random_u32_below(E + 1);
  }

But trying to run it results in "not supported". Any idea what's up?

Also, it'd be nice if there was a way for Coccinelle to figure out
variants of that, such as I >= E in a succinct way, and maybe other
different loop constructions that amount to the same thing.

Is there any way to express what I'm after?

Thanks,
Jason

             reply	other threads:[~2022-10-20  5:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  4:56 Jason A. Donenfeld [this message]
2022-10-20  5:11 ` [cocci] "not supported" Julia Lawall
2022-10-22  1:59   ` Jason A. Donenfeld
2022-10-22  8:03     ` Julia Lawall
2022-10-22 19:45     ` [cocci] Replacing special do { … } while loops by selected function calls Markus Elfring
2022-10-23 19:36       ` Jason A. Donenfeld
2022-10-24  8:14         ` Markus Elfring
2022-10-23 11:18     ` [cocci] Checking the replacement “get_random_u32_above(0)” Markus Elfring
2022-10-23 19:37       ` Jason A. Donenfeld
2022-10-24  7:18         ` Markus Elfring
2022-10-23 13:55     ` [cocci] algebraic simplification possibilities with SmPL Markus Elfring
2022-10-23 19:39       ` Jason A. Donenfeld
2022-10-23 19:45         ` Julia Lawall
2022-10-23 19:59           ` Jason A. Donenfeld
2022-10-23 20:09             ` Julia Lawall
2022-10-24 13:12         ` Markus Elfring
2022-10-24 16:14           ` Julia Lawall
2022-10-24 16:30         ` Markus Elfring
2022-10-24 16:39           ` 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=CAHmME9rTWvUxsM-sFZh1r+D5gb-8rbHmeWiFEfobkjxDRrZO1Q@mail.gmail.com \
    --to=jason@zx2c4.com \
    --cc=cocci@inria.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 read-only IMAP folder(s) and NNTP newsgroup(s).