On Fri, 12 May 2017, Arend van Spriel wrote:
> On 5/12/2017 2:15 PM, Julia Lawall wrote:
> >
> >
> > On Fri, 12 May 2017, Arend van Spriel wrote:
> >
> > > I have the following rule in my cocci script. Actually, want to apply the
> > > patch conditionally, ie. when type S matches one or more structure
> > > definitions. Initially I had 'struct Foo *drvr, ...' but that did not work
> > > for
> > > me. Any hints are appreciated.
> > >
> > > Regards,
> > > Arend
> > >
> > > @@
> > > identifier func;
> > > identifier drvr;
> > > type T;
> > > expression list es;
> > > type S;
> > > @@
> > > T func(S *drvr, ...)
> >
> > struct i *drvr, where i is an identifier metavariable? I'm not sure what
> > you mean by one or more. Do you want to match more than the first
> > argument?
>
> Hi Julia,
>
> I mean that I want to apply the rule only if S is 'struct foo' or 'struct
> bar', but not 'struct other'. Or do I need separate rules for that?
OK, it is possible that you can put
struct \(foo\|bar\) *drvr
Or maybe \(struct foo\|struct bar\) *drvr. Or maybe the \( \) around the
whole parameter declaration.
julia
>
> Regards,
> Arend
> > julia
> >
> >
> > > {
> > > <...
> > > - brcmf_err(es);
> > > + brcmf_derr(drvr, es);
> > > ...>
> > > }
> > > _______________________________________________
> > > Cocci mailing list
> > > [email protected]
> > > https://systeme.lip6.fr/mailman/listinfo/cocci
> > >
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci