Skip to content

Commit ded9588

Browse files
committed
Fix non-only or named "void" in parameter lists
'void' must be the only parameter and unnamed to indicate no parameters. Previously, the check for functions with first parameter of void pointer, etc. didn't consider the illegal forms, so those could pass compilation.
1 parent c0c6f1c commit ded9588

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/parser.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,11 @@ void read_parameter_list_decl(func_t *func, int anon)
603603
if (lex_accept(T_close_bracket))
604604
return;
605605
strcpy(func->param_defs[vn].type_name, token);
606-
read_inner_var_decl(&func->param_defs[vn++], anon, 1);
606+
read_inner_var_decl(&func->param_defs[vn], anon, 1);
607+
if (!func->param_defs[vn].is_ptr && !func->param_defs[vn].is_func &&
608+
!func->param_defs[vn].array_size)
609+
error("'void' must be the only parameter and unnamed");
610+
vn++;
607611
lex_accept(T_comma);
608612
}
609613

0 commit comments

Comments
 (0)