SV: [Cocci] Macro parsing without ;

Nicolas Palix npalix at diku.dk
Mon Nov 30 10:12:14 CET 2009


On Monday 30 November 2009 10:01:52 Julia Lawall wrote:
> On Mon, 30 Nov 2009, Andreas.Aaen at tieto.com wrote:
> 
> > Ok.
> > 
> > With the example below. If I put:
> > ---------
> > #define HEADER(head) int head ;
> > ---------
> > I a macro.h file, then it works if I do:
> > 
> > spatch -macro_file_buildins macro.h -parse_c  test/testhead.c
> > but not if I do a:
> > spatch -macro_file macro.h -parse_c  test/testhead.c
> > and neither if the exact same #define is present in the c file itself.
> > 
> > 1) So this means that none of the #defines in the c files are read?
> > 
> > 2) I didn't understand the difference between -macro_file and -macro_file_builtins
> 
> Me either...

AFAIK one of them adds some definitions to the standard.h while the other
replaces all the definitions.

> 
> Could you try #define HEADER(head) MACROSTATMENT ?  I think that is the 
> way to handle this sort of thing.  You can see many examples in 
> standard.h.
> 
> If that doesn't help, I can look at it more this afternoon.
> 
> julia
> _______________________________________________
> Cocci mailing list
> Cocci at diku.dk
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
> 


-- 
Nicolas Palix


More information about the Cocci mailing list