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. Is there a way to fix this? Lucas De Marchi
bad-alloc2.cocci
Description: Binary data
#if TEST_FLAG
typedef struct _my_type {
int a;
long b;
} my_type;
static my_type *t;
#elif TEST_FLAG2
typedef char mytype;
static my_type *t;
#endif
int main(void)
{
#if TEST_FLAG
t = malloc(sizeof(mytype));
#elif TEST_FLAG2
t = malloc(sizeof(mytype));
#endif
return 0;
}
_______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
