From: Markus Elfring <Markus.Elfring@web.de>
To: stracelabs@gmail.com
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Changing format string usage with SmPL?
Date: Sat, 7 Dec 2019 08:49:00 +0100 [thread overview]
Message-ID: <b59b7b32-98bb-c7cb-72a8-1abdca835c05@web.de> (raw)
In-Reply-To: <CABvP5W0QkSgJRZRL4xu-DdtQ0RKkQuR-5wVn2QhvjUZCZVooUA@mail.gmail.com>
> After some research, I could create a Python function called
> fmt_replace_by_pos() to replace the %fmt by the Indice position.
I imagine that this development direction can become more interesting.
Now I would like to point a few implementation details out
which can be improved in the shown SmPL script.
> REG = re.compile('([^%]|%%)*(%[^%])')
* I suggest to move the compilation for such a regular expression
into the initialisation rule.
* I find the need for the alternation unclear.
* The data processing approach can become nicer if Coccinelle's programming interface
would support also format lists directly.
> retval[i] = { 'idx': idx, 'fmt': fmt }
I wonder about the need for a separate Python dictionary here.
> print("** ERROR: Something wrong in fmt_replace_by_pos():\n
> {}\n".format(str(e)))
Would you like to use the output channel “standard error” instead?
> @main depends on s1 && r1@
The explicit dependency specification can probably be omitted.
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2019-12-07 7:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 2:11 [Cocci] Replacing printf/format calls based on the data-type Strace Labs
2019-11-28 7:07 ` Julia Lawall
2019-11-28 17:45 ` Strace Labs
2019-11-29 14:48 ` [Cocci] Replacing printf() parameters according to used data types Markus Elfring
2019-11-28 7:50 ` Markus Elfring
2019-11-29 0:35 ` Jorge Pereira
2019-11-29 8:29 ` Markus Elfring
2019-11-29 10:57 ` Strace Labs
2019-11-29 12:33 ` Markus Elfring
2019-11-29 14:47 ` Strace Labs
2019-11-29 16:08 ` Markus Elfring
2019-11-29 17:19 ` Strace Labs
2019-11-29 17:45 ` Markus Elfring
2019-11-29 20:55 ` Julia Lawall
2019-11-30 2:25 ` Strace Labs
2019-11-30 6:35 ` Julia Lawall
2019-11-30 8:46 ` Markus Elfring
2019-12-01 8:00 ` [Cocci] Changing format string usage with SmPL? Markus Elfring
2019-12-03 3:30 ` Strace Labs
2019-12-03 5:18 ` Julia Lawall
2019-12-03 13:28 ` Markus Elfring
2019-12-03 15:43 ` [Cocci] Generation of expression lists by SmPL script rules? Markus Elfring
2019-12-03 17:28 ` [Cocci] Changing format string usage with SmPL? Strace Labs
2019-12-04 0:21 ` Strace Labs
2019-12-06 19:36 ` Markus Elfring
2019-12-07 7:49 ` Markus Elfring [this message]
2019-12-04 6:47 ` Julia Lawall
2019-12-06 19:44 ` Markus Elfring
2019-12-06 19:20 ` Markus Elfring
2019-12-03 10:01 ` Markus Elfring
2019-11-30 15:11 ` [Cocci] Replacing printf() parameters according to used data types 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:
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=b59b7b32-98bb-c7cb-72a8-1abdca835c05@web.de \
--to=markus.elfring@web.de \
--cc=cocci@systeme.lip6.fr \
--cc=stracelabs@gmail.com \
/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 NNTP newsgroup(s).