py, unix, stmhal: Allow to compile with -Wshadow.

See issue #699.
diff --git a/py/argcheck.c b/py/argcheck.c
index 243ea60..d895ede 100644
--- a/py/argcheck.c
+++ b/py/argcheck.c
@@ -84,7 +84,7 @@
             pos_found++;
             given_arg = pos[i];
         } else {
-            mp_map_elem_t *kw = mp_map_lookup(kws, MP_OBJ_NEW_QSTR(allowed[i].qstr), MP_MAP_LOOKUP);
+            mp_map_elem_t *kw = mp_map_lookup(kws, MP_OBJ_NEW_QSTR(allowed[i].qst), MP_MAP_LOOKUP);
             if (kw == NULL) {
                 if (allowed[i].flags & MP_ARG_REQUIRED) {
                     if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
@@ -92,7 +92,7 @@
                     } else {
                         nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
                             "'%s' argument required",
-                            qstr_str(allowed[i].qstr)));
+                            qstr_str(allowed[i].qst)));
                     }
                 }
                 out_vals[i] = allowed[i].defval;
diff --git a/py/compile.c b/py/compile.c
index 942dceb..8d246c3 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1229,9 +1229,9 @@
 
             // compile the decorator function
             compile_node(comp, name_nodes[0]);
-            for (int i = 1; i < name_len; i++) {
-                assert(MP_PARSE_NODE_IS_ID(name_nodes[i])); // should be
-                EMIT_ARG(load_attr, MP_PARSE_NODE_LEAF_ARG(name_nodes[i]));
+            for (int j = 1; j < name_len; j++) {
+                assert(MP_PARSE_NODE_IS_ID(name_nodes[j])); // should be
+                EMIT_ARG(load_attr, MP_PARSE_NODE_LEAF_ARG(name_nodes[j]));
             }
 
             // nodes[1] contains arguments to the decorator function, if any
@@ -2778,9 +2778,9 @@
 
                 // process rest of elements
                 for (int i = 0; i < n; i++) {
-                    mp_parse_node_t pn = nodes[i];
-                    bool is_key_value = MP_PARSE_NODE_IS_STRUCT_KIND(pn, PN_dictorsetmaker_item);
-                    compile_node(comp, pn);
+                    mp_parse_node_t pn_i = nodes[i];
+                    bool is_key_value = MP_PARSE_NODE_IS_STRUCT_KIND(pn_i, PN_dictorsetmaker_item);
+                    compile_node(comp, pn_i);
                     if (is_dict) {
                         if (!is_key_value) {
                             compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dictionary");
@@ -3489,12 +3489,12 @@
             }
             if (pass > MP_PASS_SCOPE) {
                 mp_int_t bytesize = MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[0]);
-                for (uint i = 1; i < n_args; i++) {
-                    if (!MP_PARSE_NODE_IS_SMALL_INT(pn_arg[i])) {
+                for (uint j = 1; j < n_args; j++) {
+                    if (!MP_PARSE_NODE_IS_SMALL_INT(pn_arg[j])) {
                         compile_syntax_error(comp, nodes[i], "inline assembler 'data' requires integer arguments");
                         return;
                     }
-                    EMIT_INLINE_ASM_ARG(data, bytesize, MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[i]));
+                    EMIT_INLINE_ASM_ARG(data, bytesize, MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[j]));
                 }
             }
         } else {
diff --git a/py/objmodule.c b/py/objmodule.c
index dd935ae..d1d2293 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -215,6 +215,6 @@
     return el->value;
 }
 
-void mp_module_register(qstr qstr, mp_obj_t module) {
-    mp_map_lookup(&MP_STATE_VM(mp_loaded_modules_map), MP_OBJ_NEW_QSTR(qstr), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND)->value = module;
+void mp_module_register(qstr qst, mp_obj_t module) {
+    mp_map_lookup(&MP_STATE_VM(mp_loaded_modules_map), MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND)->value = module;
 }
diff --git a/py/objstr.c b/py/objstr.c
index 5a8e4d1..55d4cbf 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1243,15 +1243,15 @@
                     break;
 
                 case 's': {
-                    mp_uint_t len;
-                    const char *s = mp_obj_str_get_data(arg, &len);
+                    mp_uint_t slen;
+                    const char *s = mp_obj_str_get_data(arg, &slen);
                     if (precision < 0) {
-                        precision = len;
+                        precision = slen;
                     }
-                    if (len > (mp_uint_t)precision) {
-                        len = precision;
+                    if (slen > (mp_uint_t)precision) {
+                        slen = precision;
                     }
-                    pfenv_print_strn(&pfenv_vstr, s, len, flags, fill, width);
+                    pfenv_print_strn(&pfenv_vstr, s, slen, flags, fill, width);
                     break;
                 }
 
@@ -1379,9 +1379,9 @@
         switch (*str) {
             case 'c':
                 if (MP_OBJ_IS_STR(arg)) {
-                    mp_uint_t len;
-                    const char *s = mp_obj_str_get_data(arg, &len);
-                    if (len != 1) {
+                    mp_uint_t slen;
+                    const char *s = mp_obj_str_get_data(arg, &slen);
+                    if (slen != 1) {
                         nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
                             "%%c requires int or char"));
                     }
@@ -1425,14 +1425,14 @@
                 vstr_t *arg_vstr = vstr_new();
                 mp_obj_print_helper((void (*)(void*, const char*, ...))vstr_printf,
                                     arg_vstr, arg, *str == 'r' ? PRINT_REPR : PRINT_STR);
-                uint len = vstr_len(arg_vstr);
+                uint vlen = vstr_len(arg_vstr);
                 if (prec < 0) {
-                    prec = len;
+                    prec = vlen;
                 }
-                if (len > (uint)prec) {
-                    len = prec;
+                if (vlen > (uint)prec) {
+                    vlen = prec;
                 }
-                pfenv_print_strn(&pfenv_vstr, vstr_str(arg_vstr), len, flags, ' ', width);
+                pfenv_print_strn(&pfenv_vstr, vstr_str(arg_vstr), vlen, flags, ' ', width);
                 vstr_free(arg_vstr);
                 break;
             }
diff --git a/py/parse.c b/py/parse.c
index 19975c7..dc2780c 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -273,12 +273,12 @@
         return;
     }
     if (parser->result_stack_top >= parser->result_stack_alloc) {
-        mp_parse_node_t *pn = m_renew_maybe(mp_parse_node_t, parser->result_stack, parser->result_stack_alloc, parser->result_stack_alloc + MICROPY_ALLOC_PARSE_RESULT_INC);
-        if (pn == NULL) {
+        mp_parse_node_t *stack = m_renew_maybe(mp_parse_node_t, parser->result_stack, parser->result_stack_alloc, parser->result_stack_alloc + MICROPY_ALLOC_PARSE_RESULT_INC);
+        if (stack == NULL) {
             memory_error(parser);
             return;
         }
-        parser->result_stack = pn;
+        parser->result_stack = stack;
         parser->result_stack_alloc += MICROPY_ALLOC_PARSE_RESULT_INC;
     }
     parser->result_stack[parser->result_stack_top++] = pn;
diff --git a/py/runtime.c b/py/runtime.c
index 22f9289..3597f56 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -104,67 +104,67 @@
 #endif
 }
 
-mp_obj_t mp_load_const_int(qstr qstr) {
-    DEBUG_OP_printf("load '%s'\n", qstr_str(qstr));
+mp_obj_t mp_load_const_int(qstr qst) {
+    DEBUG_OP_printf("load '%s'\n", qstr_str(qst));
     mp_uint_t len;
-    const byte* data = qstr_data(qstr, &len);
+    const byte* data = qstr_data(qst, &len);
     return mp_parse_num_integer((const char*)data, len, 0);
 }
 
-mp_obj_t mp_load_const_dec(qstr qstr) {
-    DEBUG_OP_printf("load '%s'\n", qstr_str(qstr));
+mp_obj_t mp_load_const_dec(qstr qst) {
+    DEBUG_OP_printf("load '%s'\n", qstr_str(qst));
     mp_uint_t len;
-    const byte* data = qstr_data(qstr, &len);
+    const byte* data = qstr_data(qst, &len);
     return mp_parse_num_decimal((const char*)data, len, true, false);
 }
 
-mp_obj_t mp_load_const_str(qstr qstr) {
-    DEBUG_OP_printf("load '%s'\n", qstr_str(qstr));
-    return MP_OBJ_NEW_QSTR(qstr);
+mp_obj_t mp_load_const_str(qstr qst) {
+    DEBUG_OP_printf("load '%s'\n", qstr_str(qst));
+    return MP_OBJ_NEW_QSTR(qst);
 }
 
-mp_obj_t mp_load_const_bytes(qstr qstr) {
-    DEBUG_OP_printf("load b'%s'\n", qstr_str(qstr));
+mp_obj_t mp_load_const_bytes(qstr qst) {
+    DEBUG_OP_printf("load b'%s'\n", qstr_str(qst));
     mp_uint_t len;
-    const byte *data = qstr_data(qstr, &len);
+    const byte *data = qstr_data(qst, &len);
     return mp_obj_new_bytes(data, len);
 }
 
-mp_obj_t mp_load_name(qstr qstr) {
+mp_obj_t mp_load_name(qstr qst) {
     // logic: search locals, globals, builtins
-    DEBUG_OP_printf("load name %s\n", qstr_str(qstr));
+    DEBUG_OP_printf("load name %s\n", qstr_str(qst));
     // If we're at the outer scope (locals == globals), dispatch to load_global right away
     if (MP_STATE_CTX(dict_locals) != MP_STATE_CTX(dict_globals)) {
-        mp_map_elem_t *elem = mp_map_lookup(&MP_STATE_CTX(dict_locals)->map, MP_OBJ_NEW_QSTR(qstr), MP_MAP_LOOKUP);
+        mp_map_elem_t *elem = mp_map_lookup(&MP_STATE_CTX(dict_locals)->map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP);
         if (elem != NULL) {
             return elem->value;
         }
     }
-    return mp_load_global(qstr);
+    return mp_load_global(qst);
 }
 
-mp_obj_t mp_load_global(qstr qstr) {
+mp_obj_t mp_load_global(qstr qst) {
     // logic: search globals, builtins
-    DEBUG_OP_printf("load global %s\n", qstr_str(qstr));
-    mp_map_elem_t *elem = mp_map_lookup(&MP_STATE_CTX(dict_globals)->map, MP_OBJ_NEW_QSTR(qstr), MP_MAP_LOOKUP);
+    DEBUG_OP_printf("load global %s\n", qstr_str(qst));
+    mp_map_elem_t *elem = mp_map_lookup(&MP_STATE_CTX(dict_globals)->map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP);
     if (elem == NULL) {
         #if MICROPY_CAN_OVERRIDE_BUILTINS
         if (MP_STATE_VM(mp_module_builtins_override_dict) != NULL) {
             // lookup in additional dynamic table of builtins first
-            elem = mp_map_lookup(&MP_STATE_VM(mp_module_builtins_override_dict)->map, MP_OBJ_NEW_QSTR(qstr), MP_MAP_LOOKUP);
+            elem = mp_map_lookup(&MP_STATE_VM(mp_module_builtins_override_dict)->map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP);
             if (elem != NULL) {
                 return elem->value;
             }
         }
         #endif
-        elem = mp_map_lookup((mp_map_t*)&mp_module_builtins_globals.map, MP_OBJ_NEW_QSTR(qstr), MP_MAP_LOOKUP);
+        elem = mp_map_lookup((mp_map_t*)&mp_module_builtins_globals.map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP);
         if (elem == NULL) {
             if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
                 nlr_raise(mp_obj_new_exception_msg(&mp_type_NameError,
                     "name not defined"));
             } else {
                 nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_NameError,
-                    "name '%s' is not defined", qstr_str(qstr)));
+                    "name '%s' is not defined", qstr_str(qst)));
             }
         }
     }
@@ -185,26 +185,26 @@
     return (mp_obj_t)&mp_builtin___build_class___obj;
 }
 
-void mp_store_name(qstr qstr, mp_obj_t obj) {
-    DEBUG_OP_printf("store name %s <- %p\n", qstr_str(qstr), obj);
-    mp_obj_dict_store(MP_STATE_CTX(dict_locals), MP_OBJ_NEW_QSTR(qstr), obj);
+void mp_store_name(qstr qst, mp_obj_t obj) {
+    DEBUG_OP_printf("store name %s <- %p\n", qstr_str(qst), obj);
+    mp_obj_dict_store(MP_STATE_CTX(dict_locals), MP_OBJ_NEW_QSTR(qst), obj);
 }
 
-void mp_delete_name(qstr qstr) {
-    DEBUG_OP_printf("delete name %s\n", qstr_str(qstr));
-    // TODO convert KeyError to NameError if qstr not found
-    mp_obj_dict_delete(MP_STATE_CTX(dict_locals), MP_OBJ_NEW_QSTR(qstr));
+void mp_delete_name(qstr qst) {
+    DEBUG_OP_printf("delete name %s\n", qstr_str(qst));
+    // TODO convert KeyError to NameError if qst not found
+    mp_obj_dict_delete(MP_STATE_CTX(dict_locals), MP_OBJ_NEW_QSTR(qst));
 }
 
-void mp_store_global(qstr qstr, mp_obj_t obj) {
-    DEBUG_OP_printf("store global %s <- %p\n", qstr_str(qstr), obj);
-    mp_obj_dict_store(MP_STATE_CTX(dict_globals), MP_OBJ_NEW_QSTR(qstr), obj);
+void mp_store_global(qstr qst, mp_obj_t obj) {
+    DEBUG_OP_printf("store global %s <- %p\n", qstr_str(qst), obj);
+    mp_obj_dict_store(MP_STATE_CTX(dict_globals), MP_OBJ_NEW_QSTR(qst), obj);
 }
 
-void mp_delete_global(qstr qstr) {
-    DEBUG_OP_printf("delete global %s\n", qstr_str(qstr));
-    // TODO convert KeyError to NameError if qstr not found
-    mp_obj_dict_delete(MP_STATE_CTX(dict_globals), MP_OBJ_NEW_QSTR(qstr));
+void mp_delete_global(qstr qst) {
+    DEBUG_OP_printf("delete global %s\n", qstr_str(qst));
+    // TODO convert KeyError to NameError if qst not found
+    mp_obj_dict_delete(MP_STATE_CTX(dict_globals), MP_OBJ_NEW_QSTR(qst));
 }
 
 mp_obj_t mp_unary_op(mp_uint_t op, mp_obj_t arg) {
diff --git a/py/runtime.h b/py/runtime.h
index 7a9c6ee..ce87bf0 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -51,7 +51,7 @@
 } mp_arg_val_t;
 
 typedef struct _mp_arg_t {
-    qstr qstr;
+    qstr qst;
     mp_uint_t flags;
     mp_arg_val_t defval;
 } mp_arg_t;
@@ -70,21 +70,21 @@
 static inline mp_obj_dict_t *mp_globals_get(void) { return MP_STATE_CTX(dict_globals); }
 static inline void mp_globals_set(mp_obj_dict_t *d) { MP_STATE_CTX(dict_globals) = d; }
 
-mp_obj_t mp_load_name(qstr qstr);
-mp_obj_t mp_load_global(qstr qstr);
+mp_obj_t mp_load_name(qstr qst);
+mp_obj_t mp_load_global(qstr qst);
 mp_obj_t mp_load_build_class(void);
-void mp_store_name(qstr qstr, mp_obj_t obj);
-void mp_store_global(qstr qstr, mp_obj_t obj);
-void mp_delete_name(qstr qstr);
-void mp_delete_global(qstr qstr);
+void mp_store_name(qstr qst, mp_obj_t obj);
+void mp_store_global(qstr qst, mp_obj_t obj);
+void mp_delete_name(qstr qst);
+void mp_delete_global(qstr qst);
 
 mp_obj_t mp_unary_op(mp_uint_t op, mp_obj_t arg);
 mp_obj_t mp_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs);
 
-mp_obj_t mp_load_const_int(qstr qstr);
-mp_obj_t mp_load_const_dec(qstr qstr);
-mp_obj_t mp_load_const_str(qstr qstr);
-mp_obj_t mp_load_const_bytes(qstr qstr);
+mp_obj_t mp_load_const_int(qstr qst);
+mp_obj_t mp_load_const_dec(qstr qst);
+mp_obj_t mp_load_const_str(qstr qst);
+mp_obj_t mp_load_const_bytes(qstr qst);
 
 mp_obj_t mp_call_function_0(mp_obj_t fun);
 mp_obj_t mp_call_function_1(mp_obj_t fun, mp_obj_t arg);
diff --git a/py/showbc.c b/py/showbc.c
index 51a1671..abff93a 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -43,9 +43,9 @@
 #define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0)
 #define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0)
 #define DECODE_QSTR { \
-    qstr = 0; \
+    qst = 0; \
     do { \
-        qstr = (qstr << 7) + (*ip & 0x7f); \
+        qst = (qst << 7) + (*ip & 0x7f); \
     } while ((*ip++ & 0x80) != 0); \
 }
 #define DECODE_PTR do { \
@@ -131,7 +131,7 @@
 
 const byte *mp_bytecode_print_str(const byte *ip) {
     mp_uint_t unum;
-    qstr qstr;
+    qstr qst;
 
     switch (*ip++) {
         case MP_BC_LOAD_CONST_FALSE:
@@ -165,22 +165,22 @@
 
         case MP_BC_LOAD_CONST_INT:
             DECODE_QSTR;
-            printf("LOAD_CONST_INT %s", qstr_str(qstr));
+            printf("LOAD_CONST_INT %s", qstr_str(qst));
             break;
 
         case MP_BC_LOAD_CONST_DEC:
             DECODE_QSTR;
-            printf("LOAD_CONST_DEC %s", qstr_str(qstr));
+            printf("LOAD_CONST_DEC %s", qstr_str(qst));
             break;
 
         case MP_BC_LOAD_CONST_BYTES:
             DECODE_QSTR;
-            printf("LOAD_CONST_BYTES %s", qstr_str(qstr));
+            printf("LOAD_CONST_BYTES %s", qstr_str(qst));
             break;
 
         case MP_BC_LOAD_CONST_STRING:
             DECODE_QSTR;
-            printf("LOAD_CONST_STRING '%s'", qstr_str(qstr));
+            printf("LOAD_CONST_STRING '%s'", qstr_str(qst));
             break;
 
         case MP_BC_LOAD_CONST_OBJ:
@@ -205,7 +205,7 @@
 
         case MP_BC_LOAD_NAME:
             DECODE_QSTR;
-            printf("LOAD_NAME %s", qstr_str(qstr));
+            printf("LOAD_NAME %s", qstr_str(qst));
             if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
                 printf(" (cache=%u)", *ip++);
             }
@@ -213,7 +213,7 @@
 
         case MP_BC_LOAD_GLOBAL:
             DECODE_QSTR;
-            printf("LOAD_GLOBAL %s", qstr_str(qstr));
+            printf("LOAD_GLOBAL %s", qstr_str(qst));
             if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
                 printf(" (cache=%u)", *ip++);
             }
@@ -221,7 +221,7 @@
 
         case MP_BC_LOAD_ATTR:
             DECODE_QSTR;
-            printf("LOAD_ATTR %s", qstr_str(qstr));
+            printf("LOAD_ATTR %s", qstr_str(qst));
             if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
                 printf(" (cache=%u)", *ip++);
             }
@@ -229,7 +229,7 @@
 
         case MP_BC_LOAD_METHOD:
             DECODE_QSTR;
-            printf("LOAD_METHOD %s", qstr_str(qstr));
+            printf("LOAD_METHOD %s", qstr_str(qst));
             break;
 
         case MP_BC_LOAD_BUILD_CLASS:
@@ -252,17 +252,17 @@
 
         case MP_BC_STORE_NAME:
             DECODE_QSTR;
-            printf("STORE_NAME %s", qstr_str(qstr));
+            printf("STORE_NAME %s", qstr_str(qst));
             break;
 
         case MP_BC_STORE_GLOBAL:
             DECODE_QSTR;
-            printf("STORE_GLOBAL %s", qstr_str(qstr));
+            printf("STORE_GLOBAL %s", qstr_str(qst));
             break;
 
         case MP_BC_STORE_ATTR:
             DECODE_QSTR;
-            printf("STORE_ATTR %s", qstr_str(qstr));
+            printf("STORE_ATTR %s", qstr_str(qst));
             if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
                 printf(" (cache=%u)", *ip++);
             }
@@ -284,7 +284,7 @@
 
         case MP_BC_DELETE_NAME:
             DECODE_QSTR;
-            printf("DELETE_NAME %s", qstr_str(qstr));
+            printf("DELETE_NAME %s", qstr_str(qst));
             break;
 
         case MP_BC_DUP_TOP:
@@ -502,12 +502,12 @@
 
         case MP_BC_IMPORT_NAME:
             DECODE_QSTR;
-            printf("IMPORT_NAME '%s'", qstr_str(qstr));
+            printf("IMPORT_NAME '%s'", qstr_str(qst));
             break;
 
         case MP_BC_IMPORT_FROM:
             DECODE_QSTR;
-            printf("IMPORT_FROM '%s'", qstr_str(qstr));
+            printf("IMPORT_FROM '%s'", qstr_str(qst));
             break;
 
         case MP_BC_IMPORT_STAR: