> I'm trying to write a rule to match consecutive function calls. For example:
> @r@
> expression E, E1;
> @@
>
>   call_func(E);
>   ... when != E = E1
> * call_func(E);
>
> It works well, but not in case "E == p->f" and p is updated in between calls.
> So, I'm to understand how can I avoid these kind of pointers update.

You would like to exclude assignments between calls of functions
with a single parameter. The specified metavariable type is obviously used
in the generic way so far.
Would you like to add any constraints on the modification for identifiers
within expressions?


> And fail case example:
…
void test(void)
{
…
        for(i = t; i < i + 10; ++i) {
                call_func(i->a);
        }
}


I imagine that the interpretation of this software example will depend
also on applied technologies like the following.

1. Computation tree logic
   Can it be there are no consecutive function calls because a single statement
   was specified (for the loop)?
   (See also: Option “--no-loops”)
   
https://github.com/coccinelle/coccinelle/blob/7cf2c23e64066d5249a64a316cc5347831f7a63f/docs/manual/spatch_options.tex#L350

2. Linear temporal logic
   Statements would be consecutive if loop unrolling would be performed.


> While I tried to figure it out, I faced some cocci constructions with no 
> documentation.

How do you think about to influence this software situation any more?

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

Reply via email to