On Wed, 30 Jun 2010, Nicolas Palix wrote:

> On Wednesday 30 June 2010 22:39:59 Lucas De Marchi wrote:
> > On Wed, Jun 30, 2010 at 5:19 PM, Lucas De Marchi
> > <[email protected]> wrote:
> > > I've made some additional tests, printing where the function is called
> > > and where it's defined.
> > 
> > It seems that the problem is the expansion of START_TEST and END_TEST.
> > If I redefine them in source file as following, there's no problem
> > anymore.
> > 
> > #ifdef START_TEST
> > #undef START_TEST
> > #undef END_TEST
> > #endif
> > 
> > #define START_TEST(x) void x(void)
> > #define END_TEST
> > 
> > Also, adding the argument "-macro_file  /usr/include/check.h" solves
> > the problem without the defines above. But, do I really need to pass
> > it by hand? It was already included in source file.
> 
> Yes. You need it. The includes in the source files are used to infer types.
> As coccinelle works on unpreprocessed source code, you have to give some 
> "hints"
> to parse properly some C files. That is one of the purposes of standard.h

I think the included .h files are taken into account a little but, but I 
am not sure in what case.  -macro_files also gives you the opportunity to 
provide a simpler definition when you don't really case about the real 
one.  For example, perhaps END_TEST is defined to be something, but that 
doesn't matter for coccinelle, so we can just #define it to be nothing, 
which is sufficient to makethe code parse properly.

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

Reply via email to