Coccinelle does not perform alias analysis.
Would it make sense to add support for this feature in your software?
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, };
Do you mean here that the cases "use of a variable" and "access to a data
structure member" can be handled in a similar way by the semantic patch language?
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.
We try to develop an approach which will be generic enough to analyse a wide
range of source code from various source files. I would prefer to reduce the
number of "left-overs" that remain for harder manual inspection.
At least in some kinds of software, it seems unlikely that someone would write
a->b = printf;
That can be the case in some application areas. But my overview on the
creativity of software developers is still incomplete so there might be more
interesting uses of such function pointer assignments.
By the way: I imagine that this pattern would also need a bit fine-tuning to
determine if the address is eventually taken for a function by the operator "&"
and later reused unchanged or with extra dereferencing by the operator "*".
http://stackoverflow.com/questions/258422/function-pointers-in-c-address-operator-unnecessary
http://stackoverflow.com/questions/2795575/how-does-dereferencing-of-a-function-pointer-happen
http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Calling-Functions-Through-Function-Pointers
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)