[Cocci] Q: question on disjunction of sub-expression patterns

Oleg Nesterov oleg at redhat.com
Sun Apr 23 17:08:16 CEST 2017


On 04/22, Julia Lawall wrote:
>
> On Sat, 22 Apr 2017, Oleg Nesterov wrote:
>
> > It looks as if only one pattern from disjunction can match in the same statement.
> > IOW, (PAT1 | PAT2) actually means (PAT1* | PAT2*), not (PAT1 | PAT2)*. Say,
> >
> The idea with a disjunction is that if the first rule matches, then that
> one wins.  Actually, ( A | B ) is encoded as A v (not A & B).

OK, thanks a lot Julia!

Does this mean that I have to write 2 separate rules if I want to track the member
dereferences? One for "->" and another for ".", because I can't use the "operator"
metadecl in this case.

Oleg.



More information about the Cocci mailing list