shithub: scc

Download patch

ref: 2b85cb9a6ffdbe1354527e6b67ba0c95fb80fd6f
parent: c0e6f34d48f224066a0bed28dcdd25eb96b4748d
author: Michael Forney <[email protected]>
date: Wed Feb 15 18:30:16 EST 2017

Use assign() to parse va_start last arg symbol

--- a/cc1/builtin.c
+++ b/cc1/builtin.c
@@ -58,21 +58,19 @@
 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");