[cfe-dev] Macro expansion weirdness (or bug?)

Abramo Bagnara abramo.bagnara at gmail.com
Thu Mar 25 10:51:07 PDT 2010


Expanding this snippet:

#define n(v) v
#define l X m
#define m l
n(m)

clang preprocessor generate three MacroExpands callbacks in this order:

n, m, l

As it can be seen no other expansion are attempted (so to avoid
recursivity) and everything is fine.

If I remove the X as in:

#define n(v) v
#define l m
#define m l
n(m)

the generated MacroExpands callbacks are in order:

n, m, l, m, l

This seems very strange to me and I guess it a symptom of a bug
somewhere in macro expansion machinery.

Do you confirm this is an unwanted behaviour and that I should report an
issue to bugzilla?



More information about the cfe-dev mailing list