From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Subject: [cocci] Determining names for function parameters with SmPL?
Date: Tue, 11 Nov 2025 15:48:17 +0100 [thread overview]
Message-ID: <37e60371-6ec6-475e-a901-d83c88d50e10@web.de> (raw)
Hello,
I constructed the following SmPL script variant.
@initialize:python@
@@
import sys
def store_data(id, parameters, computation):
for parameter in parameters:
sys.stdout.write(f"identifier “{id}”: parameter: {repr(parameter)}\n")
@searching@
expression e;
identifier action;
parameter list pl;
type return_type != void;
@@
static inline return_type action(pl)
{
return e;
}
@script:python collection@
id << searching.action;
parameters << searching.pl;
computation << searching.e;
@@
store_data(id, parameters, computation)
Corresponding source file example:
static inline long my_test_calculation(int x, int y)
{
return x + y;
}
Unfortunately, I am wondering about the following information.
Questionable test result (according to the software combination “Coccinelle 1.3.0”):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch ../Probe/test-inline_function.c list_inline_non-void_functions3.cocci
…
identifier “my_test_calculation”: parameter: 'int x'
identifier “my_test_calculation”: parameter: 'int y'
The function arguments are passed as strings.
How should their names be determined from such data?
Will any other data structures become more appropriate for this use case?
Regards,
Markus
reply other threads:[~2025-11-11 14:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=37e60371-6ec6-475e-a901-d83c88d50e10@web.de \
--to=markus.elfring@web.de \
--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).