Mercurial > ~dholland > hg > tradcpp > index.cgi
changeset 155:e6eb15635a48
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.
author | David A. Holland |
---|---|
date | Fri, 12 Jun 2015 01:53:42 -0400 |
parents | a2c2fe8dbea3 |
children | e8f7ae63844f 8d8a4bfd4684 |
files | macro.c |
diffstat | 1 files changed, 3 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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;