title: Expanding macro globally: is it possible to automate?
body: <p>I'm working on a really crappy codebase. To give you an idea, here's how they do loops:</p>
  
  <pre><code>#define loop(v,m) for(int v = 0; v &lt; int(m); ++v)
  </code></pre>
  
  <p>This is done everywhere. And it gets even worse:</p>
  
  <pre><code>#define loopi(m) loop(i, m)
  #define loopj(m) loop(j, m)
  #define loopk(m) loop(k, m)
  #define loopl(m) loop(l, m)
  #define looprev(v, m) for (int v = int(m); --v &gt;= 0;)
  #define loopirev(m) looprev(i, m)
  #define loopjrev(m) looprev(j, m)
  #define loopkrev(m) looprev(k, m)
  #define looplrev(m) looprev(l, m)
  </code></pre>
  
  <p>I have tried Eclipse's macro expansion refactoring tool, but it crashes. Is there a tool that can help me with this? This is just one of the hundreds of macros like this. </p>