Skip to content
Snippets Groups Projects
Commit 382f92fe authored by benjamin.franksen's avatar benjamin.franksen
Browse files

snc: allow empty parameter list instead of (void) as in C++

parent b89cbb31
No related branches found
No related tags found
No related merge requests found
...@@ -104,8 +104,7 @@ static void analyse_funcdef(Expr *defn) ...@@ -104,8 +104,7 @@ static void analyse_funcdef(Expr *defn)
} }
p = fun_type->param_decls; p = fun_type->param_decls;
assert(p); /* invariant enforced by syntax */ if (p && p->extra.e_decl->type->tag == T_VOID)
if (p->extra.e_decl->type->tag == T_VOID)
{ {
/* no other params should be there */ /* no other params should be there */
if (p->next) if (p->next)
......
...@@ -201,6 +201,7 @@ declarator(p) ::= LPAREN declarator(x) RPAREN. [PRE] { p = x; } ...@@ -201,6 +201,7 @@ declarator(p) ::= LPAREN declarator(x) RPAREN. [PRE] { p = x; }
declarator(p) ::= ASTERISK declarator(x). [PRE] { p = decl_prefix_pointer(x); } declarator(p) ::= ASTERISK declarator(x). [PRE] { p = decl_prefix_pointer(x); }
declarator(p) ::= CONST declarator(x). [PRE] { p = decl_prefix_const(x); } declarator(p) ::= CONST declarator(x). [PRE] { p = decl_prefix_const(x); }
param_decls(p) ::= . { p = 0; }
param_decls(p) ::= param_decl(x). { p = x; } param_decls(p) ::= param_decl(x). { p = x; }
param_decls(p) ::= param_decls(xs) COMMA param_decl(x). { p = link_expr(xs, x); } param_decls(p) ::= param_decls(xs) COMMA param_decl(x). { p = link_expr(xs, x); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment