Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Jakob Koschel <jkl820.git@gmail.com>
To: cocci@inria.fr
Cc: julia.lawall@lip6.fr, Jakob Koschel <jkl820.git@gmail.com>
Subject: [cocci]  match arbitrary argument position
Date: Tue, 16 Aug 2022 10:58:59 +0200	[thread overview]
Message-ID: <20220816085859.1546867-1-jkl820.git@gmail.com> (raw)

Hi,

(resending be cause I accidently included a private email address in cc,
can the duplicate be removed/rejected from the mailing list archive?)

sorry if this question is not suiting here.

I went through the documentation and most of the examples I could find, but wasn't
able to easily answer my question I'm wondering about.

Basically: is there a way to match to *any* argument? E.g. make something match both of
the 'x' uses in the function calls here:

int x = 5;

function_call1(x, 12, 12);

function_call2(0, x);



Based on that I was wondering if there is a way to say: match if the expression is
within an expression list. So if I for instance have something like this:

  @main@
  type T;
  parameter list P;
  expression list E;
  expression E1;
  identifier func, func_call;
  @@

  T func(P@E) {
    ...
    func_call(E1 in E)
    ...
  }

(above is not valid syntax of course)

Ideally I would like to make and get the parameters of 'func' that are used in any position
as arguments in 'func_call' if that makes sense?


Any help is very much appreciated!

Thanks,
Jakob

             reply	other threads:[~2022-08-16 11:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  8:58 Jakob Koschel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-16  8:54 [cocci] match arbitrary argument position Jakob Koschel
2022-08-16 11:37 ` Julia Lawall
2022-08-16 12:35   ` Jakob Koschel
2022-08-16 17:55     ` Markus Elfring
2022-08-17 14:26       ` Jakob Koschel
2022-08-17 19:21         ` Markus Elfring
2022-08-16 21:07     ` Julia Lawall
2022-08-17 14:18       ` Jakob Koschel
2022-08-17 14:36         ` Julia Lawall
2022-08-17 14:50           ` Jakob Koschel
2022-08-17 15:26             ` 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=20220816085859.1546867-1-jkl820.git@gmail.com \
    --to=jkl820.git@gmail.com \
    --cc=cocci@inria.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 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).