> Basically, I intend to replace alls "%s" called with "mydata->name" by "%m"
> with "mydata" or "&mydata"
How far would you get the desired source code transformation based on
software extensions around a search pattern like the following?
@find@
expression action;
expression list context, inpu
On Sun, Dec 1, 2019 at 6:00 AM Markus Elfring wrote:
> > Basically, I intend to replace alls "%s" called with "mydata->name" by
> "%m" with "mydata" or "&mydata"
>
> How far would you get the desired source code transformation based on
> software extensions around a search pattern like the follow
> De: "Strace Labs"
> À: "Markus Elfring"
> Cc: "Julia Lawall" , cocci@systeme.lip6.fr
> Envoyé: Mardi 3 Décembre 2019 11:30:14
> Objet: Re: [Cocci] Changing format string usage with SmPL?
> On Sun, Dec 1, 2019 at 6:00 AM Markus Elfring <
> > 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.
> becau
> OK, if you may have more than one argument to your print,
> then you can find the offset using an expression list metavariable:
>
> @r@
> expression list[n] between;
> @@
>
> print(s,between,h2->name,...)
>
> Then you can use r.n in your python rule to figure out where is the %s to
> change.
Th
.fr
> *Envoyé: *Mardi 3 Décembre 2019 11:30:14
> *Objet: *Re: [Cocci] Changing format string usage with SmPL?
>
> On Sun, Dec 1, 2019 at 6:00 AM Markus Elfring
> wrote:
>
>> > Basically, I intend to replace alls "%s" called with "mydata->name" by
g like:
>
> ...
> @r1@
> format list fl;
> identifier fn;
> expression list e;
> position p;
> @@
>
> fn("%@fl@", e@p)
>
>
> Then, I could handle the *format list* using *make_expr()* as well. But,
> Is it possible to rename/handle the *expression
> De: "Strace Labs"
> À: "Julia Lawall"
> Cc: "cocci"
> Envoyé: Mercredi 4 Décembre 2019 01:28:22
> Objet: Re: [Cocci] Changing format string usage with SmPL?
> Unfortunately, it doesn't work. But, I am working on some solutions usin
> Unfortunately, it doesn't work.
A bit more information would be nice for the explanation of the failure reason.
I assume that you are still looking for better support of format strings
with several conversion parameters.
> But, I am working on some solutions using Python.
I am curious how co
> Therefore, I could find the %fmt and replace by whatever I want based on
> the *expression-list. *currently struggled on that.
Are you also looking for direct support of such expression lists by
Coccinelle's programming interface (see also “man coccilib”)?
Regards,
Markus
__
> Could you fix up the expression list first? Then you can write a rule like
>
> char[] s;
>
> fn(s, ...,
> - oldcode
> + newcode
> ,...)
Can it be that such a transformation approach will only work if the number
of passed function parameters will be fixed?
How should the data processing work wit
> 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 Sm
12 matches
Mail list logo