[Cocci] Macro handling

Julia Lawall julia at diku.dk
Mon Jun 1 17:43:13 CEST 2009


On Mon, 1 Jun 2009, Yoann Padioleau wrote:

> Nicolas Palix <npalix at diku.dk> writes:
> 
> > Hi,
> >
> > I'm currently writing the semantic patch for the kernel evolution mentioned
> > here http://lkml.org/lkml/2009/5/29/51.
> >
> > It's almost done but I have a problem with macro handling (the D1 macro).
> > Yoann, I know you have recently changed that part of coccinelle.
> > What should I do to have D1 properly handled ?
> 
> What is your problem ? If you got some parsing problem
> related to a macro then you can define it in a file and
> use the -macro_file or -macro_file_builtins option.

In this case, the problem is not that there are too few macro definitions, 
but that there are too many.  D1 is defined in standard.h, even though in 
this particular context there seems to be no need for it to be, because it 
looks like a normal function call, with a semicolon at the end, and thus 
its arguments are getting skipped over.

So what is the means of getting it to ignore standard.h when standard.h is 
not needed to parse the code?  It is not very easy to remember the 
difference between -macro_file and -macro_file_builtins.

I don't know the code, though, so it may be that standard.h is needed to 
parse some other code in the function?

julia


More information about the Cocci mailing list