Markus,

so, that suggestion works the same as my previous shared statement. but,
only for calls like: *my_printf("%s", h1.name <http://h1.name>);*,
not for *my_printf("%d here also, tt=%s | %s and %m\n", id, h2->name,
h2->name, s2);*

e.g:

Code sample

int foo() {
int id;
struct mydata h1, *h2, s1, *s2;

// works fine
my_printf("%s", h1.name);
my_printf("%s", h2->name);
my_printf("%s");

// don't match.
my_printf("%s %d", h2->name, id);
my_printf("%s %s", h2->name, h2->name);
my_printf("%d it would work but dunno mydata=%m\n", id, h2);
my_printf("%d here also, tt=%s | %s and %m\n", id, h2->name, h2->name, s2);
}

so, I am not sure if Coccinelle is able to do that. I've read all samples
available in the Kernel and Coccinelle repo's and I didn't see any similar
case.

I think that if @Julia Lawall <[email protected]> don't know, No one in
the world knows. šŸ˜‚



On Fri, Nov 29, 2019 at 10:33 AM Markus Elfring <[email protected]>
wrote:

> >>. Did you try out to work with SmPL ellipses and disjunctions for this
> purpose?
> >
> > I didn't it, do you have any suggestions or sample that is it possible
> > to solve my problem? something to based on.
>
> Can you get further development ideas from a transformation approach
> like the following?
>
> @replacement@
> struct mydata SMD;
> struct mydata* SMDP;
> format F =~ "s";
> @@
>  my_printf(
> -          "%@F@"
> +          "%m"
>            ,
> (
> +           &
>              SMD
> -               .name
> |
>             SMDP
> -               ->name
> )
>           );
>
>
>
> > I mean, the Coccinelle/Python support.
>
> This programming interface contains also open issues for further
> considerations
> as you can see from a topic like ā€œPropagating values back from Python
> script
> to SmPL rule with other metavariable type than ā€œidentifierā€ā€.
> https://github.com/coccinelle/coccinelle/issues/86
>
> Regards,
> Markus
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to