[cfe-dev] How to get more info from macro expansion
    Abramo Bagnara 
    abramo.bagnara at gmail.com
       
    Fri May 13 06:12:46 PDT 2011
    
    
  
Given a macro expansion I'd need to have the source range for each
expansion arguments and the range of expanded tokens.
This info can be used to check that the source range of each macro
arguments match with an expression source range and the same is true for
expanded tokens range.
This would permit to diagnose the following two kinds of macro misuse.
#define ADD(a, b) a + b
#define MUL(a, b) (a * b)
void f() {
  int x, y;
  x * ADD(x, y);
  MUL(x, x + y);
}
    
    
More information about the cfe-dev
mailing list