The reason is that ... matches the shortest path between what is before the ...
and what is after (implicitly the end of the function in this case).

Would you like to add this explanation for the behaviour of the SmPL ellipsis to the documentation?

OK.

The semantic patch is also unnecessarily verbose. Actually (a)->c is an
expression, so any code that it matches would also be matched by (x).

I have imagined that the discussed expression needs specific constraints for the use of the access operators "." and "->" so that calls to member functions which do not perform input parameter validation will be properly identified.

I don't understand the above. An expression is any expression. But only things like f, f.a, f.a.b.c.d, f->a->b are likely to appear in function position.

Does an expression cover more than this use case?


Furthermore, you can reuse metavariables between disjunction branches,
eg c and d can be the same metavariable in is_assigned. And you can also reuse
metavariables between a sequence of whens.

I admit that I am still unsure when metavariables can be reused for pattern alternatives. I would like to avoid potential conflicts because of the same name at several places in a SmPL rule.

It can be done in the different branches of an or and in successive when clauses on the same ...

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to