On Fri, 17 Dec 2010, Michael T wrote:

> Julia Lawall <julia <at> diku.dk> writes:
> > On Fri, 17 Dec 2010, Michael T wrote:
> [snip]
> > > Surely it would be possible to make Coccinelle sufficiently aware of these
> > > syntactic forms that it can parse the files and get the correct flow in 
> ninety
> > > percent of cases.
> > 
> > Allowing :: in identifier names is certainly possible.  We could even 
> > allow <>.  But aren't there class declarations in C++?  All code inside 
> > them would be completely ignored.
> 
> Classes (and structs, as in C++ the two are essentially the same thing) can
> include member function definitions among other things.  So for this case
> accepting definitions here and treating them as normal C/C++ functions would 
> do
> the trick.

This might be complicated.  The parser is very oriented towards finding 
functions at top level.

> Before I take too much of your time though, are you interested in finding 
> rules
> of thumb that would make Coccinelle work with more C++ code than it currently
> does?  It would certainly suit the code base I am working on fine, as that is
> essentially C code inside .cpp files with a few C++ constructs where we think
> they make sense.

I don't have a lot of time to work on this right now.  However just 
allowing : < and > in identifier names I could do in a few minutes.  
Perhaps you could try it with that and see if it is useful at all.

Coccinelle seems to be ok with for loops that declare variables.

If there are other things, it would be good to collect them somewhere.  
Perhaps on the wiki?  Or on the github todo list?

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

Reply via email to