All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci]  match arbitrary argument position
@ 2022-08-16  8:54 Jakob Koschel
  2022-08-16 11:37 ` Julia Lawall
  0 siblings, 1 reply; 26+ messages in thread
From: Jakob Koschel @ 2022-08-16  8:54 UTC (permalink / raw)
  To: cocci, jkl820.misc; +Cc: julia.lawall, Jakob Koschel

Hi,

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

^ permalink raw reply	[flat|nested] 26+ messages in thread
* [cocci]  match arbitrary argument position
@ 2022-08-16  8:58 Jakob Koschel
  0 siblings, 0 replies; 26+ messages in thread
From: Jakob Koschel @ 2022-08-16  8:58 UTC (permalink / raw)
  To: cocci; +Cc: julia.lawall, Jakob Koschel

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-08-21 11:34 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2022-08-17 19:48           ` [cocci] Working with parameter/expression lists by SmPL Markus Elfring
2022-08-18 12:51             ` Jakob Koschel
2022-08-18 17:42               ` Markus Elfring
2022-08-19  9:12                 ` Jakob Koschel
2022-08-19  9:57                   ` Julia Lawall
2022-08-19 10:00                     ` Jakob Koschel
2022-08-19 17:00                   ` Markus Elfring
2022-08-20 12:57                     ` Jakob Koschel
2022-08-21  8:10                       ` Markus Elfring
2022-08-21  9:09                         ` Julia Lawall
2022-08-21  9:46                           ` Markus Elfring
2022-08-21 10:01                             ` Julia Lawall
2022-08-21 11:33                               ` Markus Elfring
2022-08-18 18:00               ` [cocci] Checking a comment addition Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2022-08-16  8:58 [cocci] match arbitrary argument position Jakob Koschel

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.