From 0881f3e4b140ed66c0a15187bc1c66a3c00c872d Mon Sep 17 00:00:00 2001 From: Luke Zhu Date: Sun, 27 Oct 2024 01:24:43 +0000 Subject: [PATCH] func_params token skip refactor In func_params, the branch for handling "..." calls skip(tok, ")"), which seemed suspicious. After careful inspection, I realize the return value is not being used, so there is no bug. Nevertheless, it may still be worth it to move the skip to the bottom of the function. --- parse.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parse.c b/parse.c index 6acaeb8..104be31 100644 --- a/parse.c +++ b/parse.c @@ -598,7 +598,6 @@ static Type *func_params(Token **rest, Token *tok, Type *ty) { if (equal(tok, "...")) { is_variadic = true; tok = tok->next; - skip(tok, ")"); break; } @@ -628,7 +627,7 @@ static Type *func_params(Token **rest, Token *tok, Type *ty) { ty = func_type(ty); ty->params = head.next; ty->is_variadic = is_variadic; - *rest = tok->next; + *rest = skip(tok, ")"); return ty; }