On Thu, 22 Dec 2011, SF Markus Elfring wrote:
Would you like to acknowledge that function names will need SmPL
constraints
that will be different from the name list for function pointers in data
structures?
I don't understand this sentence at all.
I try to apply constraints for SmPL metavariables because some functions must
be handled specially because they do not perform input parameter validation.
http://coccinelle.lip6.fr/docs/main_grammar002.html#metadecl
My programming experience shows that the name sets are different for
- direct function calls
and
- calls to member functions.
I guess that you are also used to this software development issue, aren't
you?
I'm not so experienced to express this distinction with the semantic patch
language.
Coccinelle does not perform alias analysis. You can search for eg
particular types and field names that may be initialized to a function you
find undesirable, and then drop calls to those functions as illustrated in
the previous mail. For example:
@badfields@
type t;
t x;
identifier f;
@@
x.f = \(badfunction1\|badfunction2\|badfunction3\);
By isomorphisms, this should take care of the case where it is x->f and
the case where there is a statis structure declaration, ie
E.fld = E1; => T I = { .fld = E1, };
But you might also want to consider whether this case happens in practice,
or if it happens often enough that it is a problem just to filter out the
false positives by hand later. At least in some kinds of software, it
seems unlikely that someone would write
a->b = printf;
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)