summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorJun Wu <quark@lihdd.net>2019-05-04 20:29:43 -0700
committerDamien George <damien.p.george@gmail.com>2019-05-06 18:28:28 +1000
commit089c9b71d10bd66549858254cc10803cba45453a (patch)
treee1f28ec6f5630e76eba8f5789977ff69e584f1e7 /py/compile.c
parent32ba679924b8f5c8a81cff905e6bd295c6bb4df8 (diff)
py: remove "if (0)" and "if (false)" branches.
Prior to this commit, building the unix port with `DEBUG=1` and `-finstrument-functions` the compilation would fail with an error like "control reaches end of non-void function". This change fixes this by removing the problematic "if (0)" branches. Not all branches affect compilation, but they are all removed for consistency.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/py/compile.c b/py/compile.c
index 01e4ff9b6..27b706c8f 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3457,12 +3457,12 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
#endif
uint max_num_labels = 0;
for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
- if (false) {
#if MICROPY_EMIT_INLINE_ASM
- } else if (s->emit_options == MP_EMIT_OPT_ASM) {
+ if (s->emit_options == MP_EMIT_OPT_ASM) {
compile_scope_inline_asm(comp, s, MP_PASS_SCOPE);
+ } else
#endif
- } else {
+ {
compile_scope(comp, s, MP_PASS_SCOPE);
// Check if any implicitly declared variables should be closed over
@@ -3493,11 +3493,8 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
emit_t *emit_native = NULL;
#endif
for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
- if (false) {
- // dummy
-
#if MICROPY_EMIT_INLINE_ASM
- } else if (s->emit_options == MP_EMIT_OPT_ASM) {
+ if (s->emit_options == MP_EMIT_OPT_ASM) {
// inline assembly
if (comp->emit_inline_asm == NULL) {
comp->emit_inline_asm = ASM_EMITTER(new)(max_num_labels);
@@ -3519,9 +3516,9 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
if (comp->compile_error == MP_OBJ_NULL) {
compile_scope_inline_asm(comp, s, MP_PASS_EMIT);
}
+ } else
#endif
-
- } else {
+ {
// choose the emit type