On Fri, 30 Oct 2015, SF Markus Elfring wrote:

> > You would have to give an example.
>
> Should an approach like the following which is derived from
> the script "demos/conjunction.cocci" also work?
>
>
> @@
> identifier f;
> @@
> -f
> +m
>   (...,3,...);
>  ...
>  g(...,3,...);
>  ...
>  f(...,
> -  8
> +  80
>    ,...);
>  ...
>  g(...,8,...);

When you have ..., the thing after the ... has to come after (in the
control-flow graph) the thing before the ...  So this would only match
code that has a call to f followed by a call to g followed by a call to f
followed by a call to g.  In particular, if the C code has no loops, then
it must contain two calls to g.  If you look a demos/conjunction.c, both
of the C functions contain only one call to g, so neither would match your
pattern.

demos/conjunction.cocci will only match code that contains a call to f
that has 3 as one of its arguments and that has 8 as another.  The 8 may
appear before or after the 3.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to