[Cocci] Wildcard matching
julia at diku.dk
Thu Apr 30 14:37:18 CEST 2009
On Thu, 30 Apr 2009, Derek M Jones wrote:
> > > Is there any way around this? I don't think it should be necessary to
> > > write *all* versions of these functions?
> > Since there is no particular reason why a function whose name contains a
> > particular substring has a particular function, Coccinelle doesn't support
> > wildcards. Perhaps you can find some other distinguishing feature of the
> > function, such as its argument type (I guess not in this case) or the type
> > that it returns. Otherwise, you have to write them all out.
> There is lots of empirical evidence to suggest that developers do use
> particular substrings to denote related functionality.
> and for more than you could possibly want to know about identifiers
> Working on mining common sequences of operations
> provides more evidence that some sequences appear throughout source.
Sure. But some don't. In looking at Linux code, sometimes the same
prefix is used for more than one thing, and sometimes a few things in a
particular category do not contain the expected prefix. For automatic
transformation, it seems safer to rely on properties such as the structure
field in which a function is stored or the way in which the result of a
function is used.
More information about the Cocci