> Usually you'd do something like first find all that have the initializer and
> then match all that where not matched before using a position metavariable. 
> E.g.
>
> @r1@
> identifier fops;
> identifier fn;
> position p;
> @@
> struct tty_operations fops@p = {
>     ...,
>     .cleanup = fn,
>     ...
> };

You don't need the ...  Coccinelle is very relaxed about matching
structure initializers.    What you provide should be a subset, in any
order, of what is present.  The ... would only be needed if you want to
add a new field initialization, and to force it to the beginning or end
of the structure.

Luis, why did you use a regular expression for cleanup?

Thanks for the contributions.

julia

> @@
> identifier fops;
> identifier fn;
> position p != r1.p;
> @@
> *struct tty_operations fops@p = {
>     ...
> };
>
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to