From: Eric Leblond Date: Mon, 10 Jul 2017 22:32:51 +0000 (+0200) Subject: parser: fix bison warnings X-Git-Tag: v0.8~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07bf0d4a215337fb710cdaa73b1cae3f7a307e96;p=thirdparty%2Fnftables.git parser: fix bison warnings We had the following warnings parser_bison.y:1089:10: warning: variable 'cmd' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (erec != NULL) { ^~~~~~~~~~~~ parser_bison.y:1095:39: note: uninitialized use occurs here (yyval.cmd) = cmd_alloc(CMD_LIST, cmd, &(yyvsp[0].handle), &(yyloc), NULL); ^~~ parser_bison.y:1089:6: note: remove the 'if' if its condition is always true if (erec != NULL) { ^~~~~~~~~~~~~~~~~~ parser_bison.y:1080:12: note: initialize the variable 'cmd' to silence this warning int cmd; ^ = 0 Signed-off-by: Eric Leblond Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/parser_bison.y b/src/parser_bison.y index 45f134a8..abc41a6b 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -1093,7 +1093,8 @@ list_cmd : TABLE table_spec if (erec != NULL) { erec_queue(erec, state->msgs); YYERROR; - } + } else + YYERROR; } $$ = cmd_alloc(CMD_LIST, cmd, &$4, &@$, NULL);