On Wed, 4 Aug 2010, Lucas De Marchi wrote:

> On Thu, Jul 1, 2010 at 12:16 PM, Julia Lawall <[email protected]> wrote:
> >> Ahn... ok, this is indeed better than what I did. Write rules for the
> >> good cases and another one for the bad ones, right?
> 
> Attached, the updated version. I get a lot of false positives because
> of "#if" typedefing to different types according to some flags. For
> example, coccinelle reports lines 18 and 20 as wrong in file a.c, but
> they are right.

Actually, there is a problem in your example program.  On line 10, there
is:

typedef char mytype;

which should be:

typedef char my_type;

With that change a.c doesn't give any reports.  I have the impression that 
this is because it is taking the last definition of the typedef.  But then 
I guess there is a problem of a false negative.

In the short term, I don't think Coccinelle is going to keep track of 
processing #ifdef branches consistently.  Perhaps you want to just run cpp 
first?  There is some support for this, but unfortunately I don't know 
what it is.

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

Reply via email to