Skip to content

Commit f804833

Browse files
committed
py: Initialise variables in mp_parse correctly, to satisfy gcc warning.
1 parent 7d414a1 commit f804833

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

py/parse.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,14 +703,15 @@ mp_parse_node_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
703703
}
704704
}
705705

706-
mp_obj_t exc = MP_OBJ_NULL;
707-
mp_parse_node_t result = MP_PARSE_NODE_NULL;
706+
mp_obj_t exc;
707+
mp_parse_node_t result;
708708

709709
// check if we had a memory error
710710
if (parser.had_memory_error) {
711711
memory_error:
712712
exc = mp_obj_new_exception_msg(&mp_type_MemoryError,
713713
"parser could not allocate enough memory");
714+
result = MP_PARSE_NODE_NULL;
714715
goto finished;
715716
}
716717

@@ -727,6 +728,7 @@ mp_parse_node_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
727728

728729
// get the root parse node that we created
729730
assert(parser.result_stack_top == 1);
731+
exc = MP_OBJ_NULL;
730732
result = parser.result_stack[0];
731733

732734
finished:
@@ -765,5 +767,6 @@ mp_parse_node_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
765767
#endif
766768
#endif
767769
}
770+
result = MP_PARSE_NODE_NULL;
768771
goto finished;
769772
}

0 commit comments

Comments
 (0)