summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitglue.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-01-14 21:32:42 +0000
committerDamien George <damien.p.george@gmail.com>2015-01-14 21:32:42 +0000
commitd2d64f00fb7f1487c1fa21a456e003a801d7e711 (patch)
tree7345a9ba92baed508c4287bfca5ab09d67290821 /py/emitglue.c
parent65ef6b768cbba6a55f28c13433c3763c6567045e (diff)
downloadmicropython-d2d64f00fb7f1487c1fa21a456e003a801d7e711.tar.gz
micropython-d2d64f00fb7f1487c1fa21a456e003a801d7e711.zip
py: Add "default" to switches to allow better code flow analysis.
This helps compiler produce smaller code. Saves 124 bytes on stmhal and bare-arm.
Diffstat (limited to 'py/emitglue.c')
-rw-r--r--py/emitglue.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/emitglue.c b/py/emitglue.c
index 65d131125f..587c738ac9 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -110,6 +110,7 @@ mp_obj_t mp_make_function_from_raw_code(mp_raw_code_t *rc, mp_obj_t def_args, mp
mp_obj_t fun;
switch (rc->kind) {
case MP_CODE_BYTECODE:
+ no_other_choice:
fun = mp_obj_new_fun_bc(rc->scope_flags, rc->n_pos_args, rc->n_kwonly_args, def_args, def_kw_args, rc->u_byte.code);
break;
#if MICROPY_EMIT_NATIVE
@@ -128,7 +129,7 @@ mp_obj_t mp_make_function_from_raw_code(mp_raw_code_t *rc, mp_obj_t def_args, mp
default:
// raw code was never set (this should not happen)
assert(0);
- return mp_const_none;
+ goto no_other_choice; // to help flow control analysis
}
// check for generator functions and if so wrap in generator object