# HG changeset patch # User David A. Holland # Date 1434088422 14400 # Node ID e6eb15635a48ee437e97154dbc62d840e45ce80b # Parent a2c2fe8dbea3fd892ed9fb4c1a1f9135e442d399 Don't shortcut macro expansion of non-parameter macros. It won't work once we have more kinds of expansion items than strings and arguments, viz., magic tokens for __FILE__ and __LINE__ and so on. diff -r a2c2fe8dbea3 -r e6eb15635a48 macro.c --- a/macro.c Fri Jun 12 00:56:12 2015 -0400 +++ b/macro.c Fri Jun 12 01:53:42 2015 -0400 @@ -871,8 +871,6 @@ expand_got_word(struct expstate *es, struct place *p, char *buf, size_t len) { struct macro *m; - struct expansionitem *ei; - char *newbuf; switch (es->state) { case ES_NORMAL: @@ -886,15 +884,9 @@ if (m == NULL || m->inuse) { expand_send(es, p, buf, len); } else if (!m->hasparams) { - m->inuse = true; - assert(expansionitemarray_num(&m->expansion) == 1); - ei = expansionitemarray_get(&m->expansion, 0); - assert(ei->isstring); - newbuf = macroexpand(p, ei->string, - strlen(ei->string), false); - doexpand(es, p, newbuf, strlen(newbuf)); - dostrfree(newbuf); - m->inuse = false; + es->curmacro = m; + expand_domacro(es, p); + es->curmacro = NULL; } else { es->curmacro = m; es->state = ES_WANTLPAREN;