[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[creduce-dev] handling #defines



I just checked in a simple, very hacky pass for resolving #defines. It only handles macros that lack arguments and misses lots of other cases. There may be additional bugs. Writing this has strengthened my resolve not to reimplement CPP. The right answer here is to reuse an external tool that resembles unifdef, but that handles selective macro expansion (I already asked Tony to support this in unifdef, maybe he'll do it sometime).

This is orthogonal to pull req #110 which Eric is looking at.

If you want to play with the macro expander by itself, you can invoke it like this:

  clex define 0 foo.c

This will expand the first #define found in foo.c

John