[Cocci] Searching for pass-through functions

SF Markus Elfring elfring at users.sourceforge.net
Sun Jan 1 15:48:48 CET 2012


> I imagine that the Coccinelle software can find such implementations that are
> similar to an interface style like "strcat()" or "strcpy()" if the corresponding
> source files are available for a static code analysis.

I have tried out a simple filter pattern like the following.

@is_pass_through_candidate@
identifier pt_function, input;
type data_type;
position pos;
@@
  data_type at pos pt_function(..., data_type input, ...);


Now I wonder why the mentioned functions do not appear from a header file like 
"string.h" in my small data export experiment.
http://en.wikipedia.org/wiki/C_string_handling#Overview_of_functions

elfring at Sonne:~/Projekte/Coccinelle/lokal/demos/pass-through> spatch -sp_file 
list_pass-through_candidates.cocci -dir /usr/include -I /usr/include 
-recursive_includes -c++
...
function|"data type"|parameter|"contained in"|"source file"|line|column
getmsg|"int"|__fildes||"/usr/include/stropts.h"|51|8
...

Regards,
Markus


More information about the Cocci mailing list