[Cocci] Coccinelle errors during parsing of C-macros

Julia Lawall julia at diku.dk
Thu Apr 23 13:41:47 CEST 2009


> 1. If the macro defined to represent 2 separate code lines, there is an
>   error reported:
>      "Unsupported form of #define: File 'xxx.h', line xxx "
> 
>   The code line looks like:
>      #define INCREASE(a, b) a++;b++;

Another point about this.  The definition of this macro ends with ;, and 
so when you use it, It will look like, eg INCREASE(x,y) with no semicolon 
after it.  It is at least likely that this will cause any function that 
uses it not to be parsable.  The solution is to dd INCREASE to standard.h, 
to let it know that it should be parsed in a special way.  I think the 
declaration should be:

#define INCREASE(x) MACROSTATEMENT

despite the fact that INCREASE has two arguments, not one.

julia


More information about the Cocci mailing list