Hello,

I have to have 3 rules to remove a cast. The rules are basically
identical, they just differ by the type of an expression. That type is
inherited from different rules that aren't matching at the same time.

Now I wanted to use positions to eliminate false positives rather than
duplicating that code, but that doesn't work. Using the position in the
second rule will generate an error:
meta: semantic error: position cannot be inherited over modifications: p

Though that doesn't makes sense, as the position is never modified, only
all the other positions not matching are modified.
Here are the relevant chunks:

@ disable drop_cast @
type find.To;
type T;
To *obj;
position p != cast_good.p;
@@
- (T)
       (obj@p)


@ disable drop_cast @
type find2.To;
type T;
To *obj;
position p != cast_good.p;
@@
- (T)
       (obj@p)


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

Reply via email to