Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Using coccinelle for (quick?) syntax fixing

On Sun, 8 Aug 2010 14:45:59 -0400, Matthew Mondor
<> wrote:
> On Sun, 08 Aug 2010 18:05:11 +0200
> Jean-Yves Migeon <> wrote:
>> Opinions? Any interest in it? My intent is to put NetBSD specific
>> scripts on wiki.n.o, and provide links for more "generic" ones.
> That seems like a handy tool to save time and avoid a number of
> typos, if it's used right.  Thanks for sharing, I personally didn't
> know Coccinelle.  And example scripts can often be more useful than
> plain documentation, especially if it's in a WIP state (I liked that
> they showed in a few lines why it's better than sed :))

Yeah, the documentation is a WIP, and is rather difficult to follow;
starting with SmPL grammar is one thing, but some options are clearly not
documented, and hard to "guess" (I am not at all familiar with ocaml). I
spent approx. 1 hour to figure out how I could print file name and line
with the aprint thing, and never found a solution for pattern matching on
expression (detect "%s: "). Examples on the site _do_ help there.

It is 'error-prone", in the sense that it can raise false positives. But
when you get more familiar with it, you can either fix the cocci patch
(easy for __arraycount, I missed one of the cases... less obvious for
aprint stuff), and proof read the generated patch.

I used these examples to get familiar with it; it starts getting useful
when you try to find out buggy code, like double free() in the same
function, mutex_exit() missing in a branch before returning, etc.

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index