[cocci] Restricting argument lists for function calls (with SmPL)?

Markus Elfring <[email protected]> Thu, 26 Mar 2026 14:05:10 +0100
Newsgroups fr.inria.cocci
Message-ID <[email protected]>
Hello!

Function calls are obviously documented in the way that they can get an argument list:
comma-separated list of expressions
https://cppreference.com/w/c/language/operator_other.html#Function_call

It seems that the metavariable type “expression list” can handle corresponding data.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/233b5ceb1d5a701fb270ebdf0a9bd6be0a6ce53b/docs/manual/cocci_syntax.tex#L242

Such a list should usually contain one argument at least.
It should occasionally be restricted further.
One of the involved expressions (often a pointer) would also be referenced
at a previous source code place.

It seems that an SmPL conjunction would become helpful for such an use case.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/233b5ceb1d5a701fb270ebdf0a9bd6be0a6ce53b/docs/manual/cocci_syntax.tex#L1050-1054

How can it be determined then that a selection of repeated expressions
would be passed here?

Regards,
Markus