[Cocci] Problem when using a macro for mangling function names

Julia Lawall julia at diku.dk
Fri Mar 20 16:53:53 CET 2009


> By the way, the difference between defining a macro in a separate macro_file
> and directly in the source file is not clear to me. I guess including a macro
> definition using the #include statement in the patch definition file is
> equivalent to make this definition directly in the source file, am I right?
> But, what difference it makes when we declare it in a separate file that we
> give especially with the option -macro_file?

I haven't looked at your files yet, but will do so shortly.  As far as I 
know (Yoann can perhaps correct me), the macros defined in the C code are 
not used at all to expand the rest of the code.  It is only the macros 
defined in the external file that are taken into account.  Normally, the 
goal is to be able to write patterns that match against macro calls, 
rather than their expansion.  In a future work, one could try to use the 
actual definition, if available, and maintain both the expanded and 
unexpanded versions, but this is not done now, to the best of my 
knowledge.

julia


More information about the Cocci mailing list