On Mon, 31 Jan 2011, SF Markus Elfring wrote:

> > The function name library sounds like what is implemented in
> > iteration.cocci.
> 
> No. - My idea goes into a different direction.
> 
> A couple of application programming interfaces are documented. This
> documentation should clearly indicate which predicate denotes a failed
> function call.

A couple is probably the right point of view.  For a given piece of 
software, many are likely not to be documented, particularly local wrapper 
functions.

> I imagine that a table can be created with the following columns to store some
> of the needed knowledge.
> - API identifier
> - API version
> - header file name
> - function name
> - predicate for failure check

All of this information could be read in by a script and then used within 
Coccinelle to set up new invocations of Coccinelle for each set of 
arguments, as illustrated in iteration.cocci.

> This knowledge should be transformed into a couple of filter patterns to
> insert advices (emergency brake?) into affected function implementations.
> 
> 
> > It collects the function that return ERR_PTR, and then
> > one can do what one wants with that information.
> 
> I am more interested to replace the following instructions by a direct source
> code adjustment.
> cocci.print_main("def",p1)
> cocci.print_secs("ref",p2)

Nothing prevents you from doing that.  The position variable unambiguously 
identifies what code is matched, so you can put there whatever you want.

julia

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to