cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: stracelabs@gmail.com, Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Changing format string usage with SmPL?
Date: Tue, 3 Dec 2019 11:01:46 +0100	[thread overview]
Message-ID: <efbd9ebe-d437-d172-1c9a-96662abb3bd7@web.de> (raw)
In-Reply-To: <CABvP5W3E3zP28kUsmrvUOqv-Tu1YT3zvi6c=mqx+ahbMTycqAQ@mail.gmail.com>

> > Which algorithm will become sufficient for your data processing needs
> > around the usage of functions with variadic arguments because of format strings?
>
> Actually, I really didn't get why you're asking about that.

I suggest to take another look at affected software aspects.


> because we are talking about X and you're asking for Y.

I presented another approach to tackle your use case.


> the point is because I am studying about the Coccinelle

This is nice.


> and I am just trying to figure out if the tool could detect "%s"
> called with "mydata->name" and then replace by "%m" and remove the "->name"

It can be achieved for such format string parameters.
But I hope that the software development attention will grow
for the handling of multiple data conversions for several arguments.


> But, I've read again the other samples and the documentation.
> therefore, I didn't figure out how it should be.

Would you like to help to improve this area also for your needs?


> btw, thank you Julia for the suggestion performing the /Ocalm/make_expr/replace/.
> (Due to something wrong with the Coccinelle distributed by Brew/Osx.
> I just rewrote your sample using Python and the result was the same.

Both programming languages can perform string replacements as usual.


> But, I can't just replace all "%s" by "%m".

Will you become aware of more temporary software limitations
because mentioned implementation details can refer also to work in progress?


> As I said, it should be only if the "%s" was declared to use "mydata->name".

Such a requirement seems to be clear.


> so, I still fighting yet.

Can it be that your design imaginations are too limited
for the discussed use case so far?

How do you think about to develop a few corresponding SmPL script variants
which can handle more concrete function calls besides searching for a solution
according to the desired general source code transformation?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  parent reply	other threads:[~2019-12-03 10:02 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
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 [this message]
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=efbd9ebe-d437-d172-1c9a-96662abb3bd7@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.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).