scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 3e63b3f608ae6c6732758f6c55e316c3e341abde
parent f8ee0a65040db22d587ccb3f84fb6750f1bf476b
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 15 Feb 2017 23:30:16 -0800

Use assign() to parse va_start last arg symbol

Diffstat:
Mcc1/builtin.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/cc1/builtin.c b/cc1/builtin.c @@ -58,21 +58,19 @@ static Node * builtin_va_start(Symbol *sym) { Node *np, *ap, *last; - Symbol **p, *lastsym; + Symbol **p; Type *tp; ap = assign(); expect(','); - if (yytoken != IDEN) + last = assign(); + if (last->op != OSYM) goto error; - lastsym = yylval.sym; - last = varnode(lastsym); - next(); - if (!valid_va_list(ap->type) || !(lastsym->flags&SDECLARED)) + if (!valid_va_list(ap->type) || !(last->sym->flags&SDECLARED)) goto error; - for (p = curfun->u.pars; p && *p != lastsym; ++p) + for (p = curfun->u.pars; p && *p != last->sym; ++p) /* nothing */; if (!p || *p == NULL || p[1] == NULL || p[1]->type != ellipsistype) warn("second parameter of 'va_start' not last named argument");