summaryrefslogtreecommitdiffstatshomepage
path: root/py/parse.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-02-08 13:40:20 +0000
committerDamien George <damien.p.george@gmail.com>2015-02-08 13:40:20 +0000
commitf804833a97c75882653e655ee95722c4cb7ae218 (patch)
tree6efd27e58a33e2a12f8ba2adaf8c32741cc7eaed /py/parse.c
parent7d414a1b52d193bab2c94cf56932e1eba23ba542 (diff)
downloadmicropython-f804833a97c75882653e655ee95722c4cb7ae218.tar.gz
micropython-f804833a97c75882653e655ee95722c4cb7ae218.zip
py: Initialise variables in mp_parse correctly, to satisfy gcc warning.
Diffstat (limited to 'py/parse.c')
-rw-r--r--py/parse.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/py/parse.c b/py/parse.c
index 54e199e593..4ea0362d2b 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -703,14 +703,15 @@ mp_parse_node_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
}
}
- mp_obj_t exc = MP_OBJ_NULL;
- mp_parse_node_t result = MP_PARSE_NODE_NULL;
+ mp_obj_t exc;
+ mp_parse_node_t result;
// check if we had a memory error
if (parser.had_memory_error) {
memory_error:
exc = mp_obj_new_exception_msg(&mp_type_MemoryError,
"parser could not allocate enough memory");
+ result = MP_PARSE_NODE_NULL;
goto finished;
}
@@ -727,6 +728,7 @@ memory_error:
// get the root parse node that we created
assert(parser.result_stack_top == 1);
+ exc = MP_OBJ_NULL;
result = parser.result_stack[0];
finished:
@@ -765,5 +767,6 @@ syntax_error:
#endif
#endif
}
+ result = MP_PARSE_NODE_NULL;
goto finished;
}