[Cocci] Finding embedded function names?

Joe Perches joe at perches.com
Fri Dec 5 08:49:30 CET 2014


On Fri, 2014-12-05 at 08:32 +0100, Julia Lawall wrote:
> On Thu, 4 Dec 2014, Joe Perches wrote:
> > On Fri, 2014-12-05 at 08:18 +0100, Julia Lawall wrote:
> > > On Thu, 4 Dec 2014, Joe Perches wrote:
> > > > Is it possible for coccinelle to look at the name
> > > > of a function that might be embedded in a format?
[]
> > > Yes, by using python/ocaml:
[]
> > > Here are some results:
> > > 
> > > drivers/net/wireless/zd1211rw/zd_usb.c:1573: "%s usb_exit()\n"
> > []
> > > The idea would be to replace these by %s and __func__?  That would also be 
> > > possible.
> > 
> > Yes and no.
> > 
> > A lot of these are function tracing style messages and
> > those should just be deleted.
> 
> Would it be possible to characterize what a function tracing style message 
> would be?  Something like 
> "<===_rtl8723be_phy_convert_txpower_dbm_to_relative_value()\n"
> that looks like it may represent a function exit?
> 
> Anything that doesn't contain %?

Some of these tracing style messages are also
emitting arguments.  I'd still delete those.

> Anything that is not under an if?

For function entrances:
Maybe something in a function's first few non-definition
statements not under an if/while/do/for/switch?

For function exits:
Maybe the last couple statements just before a return
statement or ending brace (also not under an if/etc)





More information about the Cocci mailing list