On Sat, 17 Feb 2018, SF Markus Elfring wrote:
> >> It is easy to check the presence of such an identifier.
> >> But I find it very challenging to determine (by script code)
> >> if it is actually not passed (as an option) in a function call.
> >
> > It's not clear what you want.
>
> Another try …
>
>
> > You will have to send some examples.
>
> When we look at concrete Linux source code, we mostly see that
> the option “__GFP_NOWARN” is just missing for a call of a function
> like “devm_kmalloc”.
>
> An other analysis tool can show the information that such an identifier
> is referenced only in 207 files (from Linux 4.16-rc1).
>
> But how can the Coccinelle software help here to exclude these source
> code places from specific transformation attempts?
(
f(...,<+...__GFP_NOWARN...+>,...)
|
transformation
)
Alternatively,
@ok@
position p;
@@
f(...,<+...__GFP_NOWARN...+>,...)
@@
position p != ok.p;
@@
- f@p(...)
+ whatever
>
>
> >> How would you manage the information which of the parameters
> >> would get the argument “gfp” (for example)?
> >
> > You have to match the definition of the function to find out what
> > parameter position you are interested in.
>
> It seems to be feasible to encode such knowledge for a small number
> of function names (in SmPL disjunctions or regular expressions).
>
> But how does the software situation look like when you would like
> to automate the search for interesting positions as much as possible?
My iteration suggestion covers this case.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci