howto conditional match
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, ...)
{
<...
- brcmf_err(es);
+ brcmf_derr(drvr, es);
...>
}Quoted 8 lines · Arend van Spriel
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
Quoted 8 lines
@@
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?
julia
Quoted 11 lines
{ <...(quoted diff) +1
-1- brcmf_err(es); + brcmf_derr(drvr, es); ...> }_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 21 lines · Julia Lawall
Quoted 8 lines · Arend van Spriel
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,
ArendQuoted 8 lines
@@
identifier func;
identifier drvr;
type T;
expression list es;
type S;
@@T func(S *drvr, ...)
Quoted 3 lines
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?
Regards,
Arend
Quoted 14 lines
julia
Quoted 11 lines
{ <...(quoted diff) +1
-1- brcmf_err(es); + brcmf_derr(drvr, es); ...> }_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 23 lines · Arend van Spriel
Quoted 22 lines · Julia Lawall
Quoted 17 lines · Arend van Spriel
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, ...)
Quoted 8 lines
Quoted 3 lines
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
Quoted 18 lines
Regards,
ArendQuoted 14 lines
julia
Quoted 11 lines
{ <...(quoted diff) +1
-1- brcmf_err(es); + brcmf_derr(drvr, es); ...> }_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci