On Wed, 2 Feb 2011, SF Markus Elfring wrote:
> >> I am looking for a way to find the corresponding function body without
> >> specifying a function name literal or an identifier meta-variable here.
> > I have told you, several times I think, that 1) there is none,
>
> Thanks for this clarification.
>
> I would appreciate if this detail can possibly be improved because I am just
> interested to find all function bodies which contain open issues in the sense
> of
> static source code analysis.
It cannot be improved. It is perfect as it is.
Coccinelle is a pattern-matching oriented system. If some information can
be obtained by matching against code, that is the way it should be done,
rather than adding special features for every piece of information someone
desires. The proper way to find out in what function there exists some
situation is to say:
@r@
identifier f;
@@
f(...) {
<+...
pattern matching your situation of interest
...+>
}
Now you can make some other rule that uses r.f. That way if one looks at
the pattern, one sees at once all of the elements of interest. There is
no overhead for doing this. All it does is bind f to the function name,
and search through the nodes of the control-flow graph to find code that
matches the pattern of interest. This is what one would have to do in
any implementation where the function name and the matching of the pattern
is wanted.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)