Skip to content

Commit

Permalink
Parser: set kind to param in old style parameter declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsan901998 authored and Vexu committed Nov 2, 2023
1 parent 87b6124 commit 45eb8a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ fn decl(p: *Parser) Error!bool {
const attr_buf_top_declarator = p.attr_buf.len;
defer p.attr_buf.len = attr_buf_top_declarator;

var d = (try p.declarator(param_decl_spec.ty, .normal)) orelse {
var d = (try p.declarator(param_decl_spec.ty, .param)) orelse {
try p.errTok(.missing_declaration, first_tok);
_ = try p.expectToken(.semicolon);
continue :param_loop;
Expand Down
4 changes: 4 additions & 0 deletions test/cases/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ void unspecified_variable_len(int n, int x[][n]) { }

static func_pointer p = unspecified_variable_len;

void static_array_parameter(x)
int x[static 5];
{}


#define EXPECTED_ERRORS "functions.c:10:12: error: parameter named 'quux' is missing" \
"functions.c:20:14: error: illegal initializer (only variables can be initialized)" \
Expand Down

0 comments on commit 45eb8a7

Please sign in to comment.