[Cocci] Distinguishing pointer data types with SmPL

SF Markus Elfring elfring at users.sourceforge.net
Wed Dec 17 21:30:05 CET 2014

>> * Which is the best way to distinguish non-pointer types from pointer data types
>>   with metavariables?
> If you do the following:
> @@
> expression * e1;
> expression e2;
> @@
> (
> e1
> |
> e2
> )
> Then e2 should match the non-pointer type expressions.

Is it relevant if you use "expression" or "type" here?

I guess that my previous use case was a bit different because the pointer
distinction was distributed over function parameters in separate SmPL rules.

I got the impression that a single metavariable with the SmPL type "type"
might be insufficient for a selection if the asterisk is omitted there.
Does the filter approach need to be disambiguated with additional criteria
like variable constraints or a part from the function implementation?


More information about the Cocci mailing list