Coccinelle archive on
 help / color / Atom feed
From: Markus Elfring <>
To: Thomas Adam <>
Subject: Re: [Cocci] Using SmPL scripts to mangle function arguments
Date: Sun, 17 May 2020 11:22:17 +0200
Message-ID: <> (raw)

> Hence, func_new() reduces the number of arguments to just one
> -- a format string, and variadic arguments.

* Does this wording contain a contradiction?

* Would you like to fiddle with any more variadic functions?

> My question is how would I go about trying to get coccinelle to help me
> translate this?  Is this even possible?

Generally, yes.

A more complete source code transformation approach can become challenging.

> @@
> expression O1, O2, O3
> @@
> - func_old(O1, O2, O3, ...);

Can it be that the item “charstring” would contain multiple expressions?

If you would like to reuse the last function parameters,
the passed code should be stored into corresponding metavariables
of a type like “constant” or “expression list”.

> + func_new("%s: ...", __func__, O3);
> I suspect I might be stretching coccinelle's abilities in trying to craft
> new parameters, but I thought I'd ask.

I imagine that the clarification of corresponding application details
can become more interesting.

Cocci mailing list

             reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17  9:22 Markus Elfring [this message]
2020-05-17  9:45 ` Julia Lawall
2020-05-26  1:21 ` Thomas Adam
2020-05-26  6:00   ` Markus Elfring
2020-05-26  6:41   ` Julia Lawall
2020-05-26 11:23 Markus Elfring

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Coccinelle archive on

Archives are clonable:
	git clone --mirror cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ \
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone