From: Michael Wallner Date: Thu, 2 Feb 2017 14:45:04 +0000 (+0100) Subject: parser: fix uninitialized args X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=991b10eeadb51b0b3309f140391ecf0b4c1e1859;p=m6w6%2Fext-psi parser: fix uninitialized args --- diff --git a/src/parser_def.h b/src/parser_def.h index 5d6a84a..1910ebf 100644 --- a/src/parser_def.h +++ b/src/parser_def.h @@ -880,12 +880,17 @@ PARSE_TYPED(decl_arg, arg_, /* * decl_args: */ -PASS(decl_args, ) +PARSE_TYPED(decl_args, args, ) { + args = NULL; +} /* * decl_args: VOID */ -PASS(decl_args, VOID) +PARSE_TYPED(decl_args, args, + TOKEN(VOID)) { + args = NULL; +} /* * decl_args: decl_arg @@ -1664,7 +1669,9 @@ PARSE_TYPED(let_exps, exps, /* * callback_arg_list: */ -PASS(callback_arg_list, ) +PARSE_TYPED(callback_arg_list, args, ) { + args = NULL; +} /* * callback_arg_list: callback_args diff --git a/src/parser_proc.y b/src/parser_proc.y index 15407e0..aa17e4c 100644 --- a/src/parser_proc.y +++ b/src/parser_proc.y @@ -500,8 +500,12 @@ decl_arg(arg_) ::= CONST VOID(T) pointers(p) NAME(N). { arg_->var->token = N; arg_->token = N; } -decl_args ::= . -decl_args ::= VOID. +decl_args(args) ::= . { + args = NULL; +} +decl_args(args) ::= VOID. { + args = NULL; +} decl_args(args) ::= decl_arg(arg). { args = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free), &arg); @@ -820,7 +824,9 @@ let_exps(exps) ::= let_exp(exp). { let_exps(exps) ::= let_exps(exps_) COMMA let_exp(exp). { exps = psi_plist_add(exps_, &exp); } -callback_arg_list ::= . +callback_arg_list(args) ::= . { + args = NULL; +} callback_arg_list(args) ::= callback_args(args_). { args = args_; }