diff options
author | Michael Forney <mforney@mforney.org> | 2019-04-06 22:49:23 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-04-07 00:22:49 -0700 |
commit | 29cfc017cad90d2755ddabc3a642267923e6a21f (patch) | |
tree | a6e03e567835d41be39b93cac95abe2082889b32 | |
parent | 18c5bbf727faf6fb30a8809b6f7900a59c07897f (diff) | |
download | cproc-29cfc017cad90d2755ddabc3a642267923e6a21f.tar.xz |
expr: Handle parenthesized paremeter name in __builtin_va_start
FreeBSD defines va_start(ap, last)=__builtin_va_start((ap), (last))
-rw-r--r-- | expr.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -395,7 +395,7 @@ static struct expr *condexpr(struct scope *); static struct expr * builtinfunc(struct scope *s, enum builtinkind kind) { - struct expr *e; + struct expr *e, *param; struct type *t; char *name; uint64_t offset; @@ -458,7 +458,10 @@ builtinfunc(struct scope *s, enum builtinkind kind) e->builtin.kind = BUILTINVASTART; e->builtin.arg = exprconvert(assignexpr(s), &typevalistptr); expect(TCOMMA, "after va_list"); - free(expect(TIDENT, "after ','")); + param = assignexpr(s); + if (param->kind != EXPRIDENT) + error(&tok.loc, "expected parameter identifier"); + delexpr(param); // XXX: check that this was actually a parameter name? break; default: |