py, unix: Allow to compile with -Wunused-parameter.
See issue #699.
diff --git a/py/asmx86.c b/py/asmx86.c
index 755ed03..11107f1 100644
--- a/py/asmx86.c
+++ b/py/asmx86.c
@@ -145,6 +145,7 @@
}
void asm_x86_end_pass(asm_x86_t *as) {
+ (void)as;
}
// all functions must go through this one to emit bytes
diff --git a/py/builtinevex.c b/py/builtinevex.c
index 9bca4a0..85ffbf4 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -75,6 +75,8 @@
}
STATIC mp_obj_t mp_builtin_compile(mp_uint_t n_args, const mp_obj_t *args) {
+ (void)n_args;
+
// get the source
mp_uint_t str_len;
const char *str = mp_obj_str_get_data(args[0], &str_len);
diff --git a/py/compile.c b/py/compile.c
index 8d246c3..ea0782e 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3210,6 +3210,9 @@
EMIT_ARG(store_id, MP_QSTR___doc__);
}
}
+#else
+ (void)comp;
+ (void)pn;
#endif
}
@@ -3514,7 +3517,7 @@
}
#endif
-STATIC void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
+STATIC void scope_compute_things(scope_t *scope) {
#if !MICROPY_EMIT_CPYTHON
// in Micro Python we put the *x parameter after all other parameters (except **y)
if (scope->scope_flags & MP_SCOPE_FLAG_VARARGS) {
@@ -3678,7 +3681,7 @@
// compute some things related to scope and identifiers
for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
- compile_scope_compute_things(comp, s);
+ scope_compute_things(s);
}
// finish with pass 1
diff --git a/py/emitbc.c b/py/emitbc.c
index 1ac49ac..f7f2b8d 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -268,6 +268,10 @@
}
STATIC void emit_bc_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t arg1, qstr arg2) {
+ (void)emit;
+ (void)op;
+ (void)arg1;
+ (void)arg2;
}
STATIC void emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
@@ -499,6 +503,7 @@
};
STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
+ (void)qst;
assert(local_num >= 0);
emit_bc_pre(emit, 1);
if (local_num <= 15) {
@@ -509,11 +514,13 @@
}
STATIC void emit_bc_load_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
+ (void)qst;
emit_bc_pre(emit, 1);
emit_write_bytecode_byte_uint(emit, MP_BC_LOAD_DEREF, local_num);
}
STATIC void emit_bc_load_name(emit_t *emit, qstr qst) {
+ (void)qst;
emit_bc_pre(emit, 1);
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_NAME, qst);
if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
@@ -522,6 +529,7 @@
}
STATIC void emit_bc_load_global(emit_t *emit, qstr qst) {
+ (void)qst;
emit_bc_pre(emit, 1);
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_GLOBAL, qst);
if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
@@ -553,6 +561,7 @@
}
STATIC void emit_bc_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
+ (void)qst;
assert(local_num >= 0);
emit_bc_pre(emit, -1);
if (local_num <= 15) {
@@ -563,6 +572,7 @@
}
STATIC void emit_bc_store_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
+ (void)qst;
emit_bc_pre(emit, -1);
emit_write_bytecode_byte_uint(emit, MP_BC_STORE_DEREF, local_num);
}
@@ -591,10 +601,12 @@
}
STATIC void emit_bc_delete_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
+ (void)qst;
emit_write_bytecode_byte_uint(emit, MP_BC_DELETE_FAST, local_num);
}
STATIC void emit_bc_delete_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
+ (void)qst;
emit_write_bytecode_byte_uint(emit, MP_BC_DELETE_DEREF, local_num);
}
diff --git a/py/emitglue.c b/py/emitglue.c
index 587c738..7064cb8 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -92,6 +92,8 @@
fwrite(fun_data, fun_len, 1, fp_write_code);
fclose(fp_write_code);
#endif
+#else
+ (void)fun_len;
#endif
}
#endif
diff --git a/py/emitnative.c b/py/emitnative.c
index a8e547f..0721636 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -740,6 +740,8 @@
}
STATIC void emit_native_set_source_line(emit_t *emit, mp_uint_t source_line) {
+ (void)emit;
+ (void)source_line;
}
/*
@@ -905,6 +907,7 @@
}
STATIC void emit_post(emit_t *emit) {
+ (void)emit;
}
STATIC void emit_post_top_set_vtype(emit_t *emit, vtype_kind_t new_vtype) {
@@ -1247,6 +1250,9 @@
STATIC void emit_native_load_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
// not implemented
// in principle could support this quite easily (ldr r0, [r0, #0]) and then get closed over variables!
+ (void)emit;
+ (void)qst;
+ (void)local_num;
assert(0);
}
@@ -1465,6 +1471,9 @@
STATIC void emit_native_store_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
// not implemented
+ (void)emit;
+ (void)qst;
+ (void)local_num;
assert(0);
}
@@ -1634,10 +1643,16 @@
// local is automatically deleted for exception block "as" var, and the message
// breaks tests.
//mp_emitter_warning(emit->pass, "Native codegeneration doesn't support deleting local");
+ (void)emit;
+ (void)qst;
+ (void)local_num;
}
STATIC void emit_native_delete_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
// TODO implement me!
+ (void)emit;
+ (void)qst;
+ (void)local_num;
}
STATIC void emit_native_delete_name(emit_t *emit, qstr qst) {
@@ -1711,7 +1726,7 @@
emit_post(emit);
}
-STATIC void emit_native_jump_helper(emit_t *emit, mp_uint_t label, bool pop) {
+STATIC void emit_native_jump_helper(emit_t *emit, bool pop) {
vtype_kind_t vtype = peek_vtype(emit, 0);
switch (vtype) {
case VTYPE_PYOBJ:
@@ -1744,21 +1759,21 @@
STATIC void emit_native_pop_jump_if_true(emit_t *emit, mp_uint_t label) {
DEBUG_printf("pop_jump_if_true(label=" UINT_FMT ")\n", label);
- emit_native_jump_helper(emit, label, true);
+ emit_native_jump_helper(emit, true);
ASM_JUMP_IF_REG_NONZERO(emit->as, REG_RET, label);
emit_post(emit);
}
STATIC void emit_native_pop_jump_if_false(emit_t *emit, mp_uint_t label) {
DEBUG_printf("pop_jump_if_false(label=" UINT_FMT ")\n", label);
- emit_native_jump_helper(emit, label, true);
+ emit_native_jump_helper(emit, true);
ASM_JUMP_IF_REG_ZERO(emit->as, REG_RET, label);
emit_post(emit);
}
STATIC void emit_native_jump_if_true_or_pop(emit_t *emit, mp_uint_t label) {
DEBUG_printf("jump_if_true_or_pop(label=" UINT_FMT ")\n", label);
- emit_native_jump_helper(emit, label, false);
+ emit_native_jump_helper(emit, false);
ASM_JUMP_IF_REG_NONZERO(emit->as, REG_RET, label);
adjust_stack(emit, -1);
emit_post(emit);
@@ -1766,26 +1781,31 @@
STATIC void emit_native_jump_if_false_or_pop(emit_t *emit, mp_uint_t label) {
DEBUG_printf("jump_if_false_or_pop(label=" UINT_FMT ")\n", label);
- emit_native_jump_helper(emit, label, false);
+ emit_native_jump_helper(emit, false);
ASM_JUMP_IF_REG_ZERO(emit->as, REG_RET, label);
adjust_stack(emit, -1);
emit_post(emit);
}
STATIC void emit_native_break_loop(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
+ (void)except_depth;
emit_native_jump(emit, label & ~MP_EMIT_BREAK_FROM_FOR); // TODO properly
}
STATIC void emit_native_continue_loop(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
+ (void)except_depth;
emit_native_jump(emit, label); // TODO properly
}
STATIC void emit_native_setup_with(emit_t *emit, mp_uint_t label) {
// not supported, or could be with runtime call
+ (void)emit;
+ (void)label;
assert(0);
}
STATIC void emit_native_with_cleanup(emit_t *emit) {
+ (void)emit;
assert(0);
}
@@ -1845,6 +1865,7 @@
}
STATIC void emit_native_pop_except(emit_t *emit) {
+ (void)emit;
/*
emit_native_pre(emit);
emit_call(emit, MP_F_NLR_POP);
@@ -2139,6 +2160,11 @@
}
STATIC void emit_native_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_over, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) {
+ (void)emit;
+ (void)scope;
+ (void)n_closed_over;
+ (void)n_pos_defaults;
+ (void)n_kw_defaults;
assert(0);
}
@@ -2238,10 +2264,12 @@
STATIC void emit_native_yield_value(emit_t *emit) {
// not supported (for now)
+ (void)emit;
assert(0);
}
STATIC void emit_native_yield_from(emit_t *emit) {
// not supported (for now)
+ (void)emit;
assert(0);
}
diff --git a/py/emitpass1.c b/py/emitpass1.c
index 941f34d..c6d9278 100644
--- a/py/emitpass1.c
+++ b/py/emitpass1.c
@@ -42,6 +42,7 @@
}
STATIC void emit_pass1_dummy(emit_t *emit) {
+ (void)emit;
}
STATIC void emit_pass1_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
@@ -50,9 +51,11 @@
}
STATIC void emit_pass1_end_pass(emit_t *emit) {
+ (void)emit;
}
STATIC bool emit_pass1_last_emit_was_return_value(emit_t *emit) {
+ (void)emit;
return false;
}
diff --git a/py/modmicropython.c b/py/modmicropython.c
index e6adc35..7d1b6bf 100644
--- a/py/modmicropython.c
+++ b/py/modmicropython.c
@@ -54,6 +54,7 @@
#endif
mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) {
+ (void)args;
#if MICROPY_MEM_STATS
printf("mem: total=" UINT_FMT ", current=" UINT_FMT ", peak=" UINT_FMT "\n",
m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated());
@@ -69,6 +70,8 @@
// arg given means dump gc allocation table
gc_dump_alloc_table();
}
+#else
+ (void)n_args;
#endif
return mp_const_none;
}
diff --git a/py/mpz.c b/py/mpz.c
index ad7414a..f5b9540 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -198,10 +198,10 @@
/* computes i = j & k
returns number of digits in i
- assumes enough memory in i; assumes normalised j, k; assumes jlen >= klen
+ assumes enough memory in i; assumes normalised j, k; assumes jlen >= klen (jlen argument not needed)
can have i, j, k pointing to same memory
*/
-STATIC mp_uint_t mpn_and(mpz_dig_t *idig, const mpz_dig_t *jdig, mp_uint_t jlen, const mpz_dig_t *kdig, mp_uint_t klen) {
+STATIC mp_uint_t mpn_and(mpz_dig_t *idig, const mpz_dig_t *jdig, const mpz_dig_t *kdig, mp_uint_t klen) {
mpz_dig_t *oidig = idig;
for (; klen > 0; --klen, ++idig, ++jdig, ++kdig) {
@@ -1081,7 +1081,7 @@
}
// do the and'ing
mpz_need_dig(dest, rhs->len);
- dest->len = mpn_and(dest->dig, lhs->dig, lhs->len, rhs->dig, rhs->len);
+ dest->len = mpn_and(dest->dig, lhs->dig, rhs->dig, rhs->len);
dest->neg = 0;
} else {
// TODO both args are negative
diff --git a/py/objarray.c b/py/objarray.c
index 2634190..25d9dae 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -77,6 +77,7 @@
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
STATIC void array_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_array_t *o = o_in;
if (o->typecode == BYTEARRAY_TYPECODE) {
print(env, "bytearray(b");
@@ -168,6 +169,7 @@
#if MICROPY_PY_ARRAY
STATIC mp_obj_t array_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 1, 2, false);
// get typecode
@@ -186,6 +188,7 @@
#if MICROPY_PY_BUILTINS_BYTEARRAY
STATIC mp_obj_t bytearray_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
if (n_args == 0) {
diff --git a/py/objbool.c b/py/objbool.c
index 6dd9e7f..d60dc8c 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -53,6 +53,7 @@
}
STATIC mp_obj_t bool_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) {
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index e451ce4..7698ed2 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -37,6 +37,7 @@
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
STATIC void bound_meth_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_bound_meth_t *o = o_in;
print(env, "<bound_method %p ", o);
mp_obj_print_helper(print, env, o->self, PRINT_REPR);
diff --git a/py/objcell.c b/py/objcell.c
index b2d4200..9e43d7f 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -43,6 +43,7 @@
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_cell_t *o = o_in;
print(env, "<cell %p ", o->obj);
if (o->obj == MP_OBJ_NULL) {
diff --git a/py/objclosure.c b/py/objclosure.c
index 853f093..95c1add 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -61,6 +61,7 @@
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
STATIC void closure_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_closure_t *o = o_in;
print(env, "<closure ");
mp_obj_print_helper(print, env, o->fun, PRINT_REPR);
diff --git a/py/objcomplex.c b/py/objcomplex.c
index 3af98e4..027292a 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -49,6 +49,7 @@
} mp_obj_complex_t;
STATIC void complex_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_complex_t *o = o_in;
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
char buf[16];
@@ -76,6 +77,7 @@
}
STATIC mp_obj_t complex_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 2, false);
switch (n_args) {
diff --git a/py/objdict.c b/py/objdict.c
index 900ecf4..e97f30e 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -74,6 +74,7 @@
}
STATIC mp_obj_t dict_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_obj_t dict = mp_obj_new_dict(0);
if (n_args > 0 || n_kw > 0) {
mp_obj_t args2[2] = {dict, args[0]}; // args[0] is always valid, even if it's not a positional arg
@@ -446,6 +447,7 @@
}
STATIC void dict_view_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
assert(MP_OBJ_IS_TYPE(self_in, &dict_view_type));
mp_obj_dict_view_t *self = self_in;
bool first = true;
diff --git a/py/objenumerate.c b/py/objenumerate.c
index 209af82..ab11538 100644
--- a/py/objenumerate.c
+++ b/py/objenumerate.c
@@ -51,12 +51,12 @@
// create enumerate object
mp_obj_enumerate_t *o = m_new_obj(mp_obj_enumerate_t);
- o->base.type = &mp_type_enumerate;
+ o->base.type = type_in;
o->iter = mp_getiter(vals[0].u_obj);
o->cur = vals[1].u_int;
#else
mp_obj_enumerate_t *o = m_new_obj(mp_obj_enumerate_t);
- o->base.type = &mp_type_enumerate;
+ o->base.type = type_in;
o->iter = mp_getiter(args[0]);
o->cur = n_args > 1 ? mp_obj_get_int(args[1]) : 0;
#endif
diff --git a/py/objfilter.c b/py/objfilter.c
index 98200f2..c9ded8d 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -39,7 +39,7 @@
}
assert(n_args == 2);
mp_obj_filter_t *o = m_new_obj(mp_obj_filter_t);
- o->base.type = &mp_type_filter;
+ o->base.type = type_in;
o->fun = args[0];
o->iter = mp_getiter(args[1]);
return o;
diff --git a/py/objfloat.c b/py/objfloat.c
index 86b6720..4323cec 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -42,6 +42,7 @@
#endif
STATIC void float_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_float_t *o = o_in;
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
char buf[16];
@@ -63,6 +64,7 @@
}
STATIC mp_obj_t float_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) {
diff --git a/py/objfun.c b/py/objfun.c
index 8f83572..28706cc 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -116,6 +116,7 @@
#if MICROPY_CPYTHON_COMPAT
STATIC void fun_bc_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_fun_bc_t *o = o_in;
print(env, "<function %s at 0x%x>", mp_obj_fun_get_name(o), o);
}
diff --git a/py/objgenerator.c b/py/objgenerator.c
index a4d22aa..e67824d 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -95,6 +95,7 @@
/* generator instance */
STATIC void gen_instance_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_gen_instance_t *self = self_in;
print(env, "<generator object '%s' at %p>", mp_obj_code_get_name(self->code_state.code_info), self_in);
}
diff --git a/py/objint.c b/py/objint.c
index f1bd5da..049d041 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -42,6 +42,7 @@
// This dispatcher function is expected to be independent of the implementation of long int
STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 2, false);
switch (n_args) {
@@ -78,6 +79,7 @@
}
void mp_obj_int_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
// The size of this buffer is rather arbitrary. If it's not large
// enough, a dynamic one will be allocated.
char stack_buf[sizeof(mp_int_t) * 4];
@@ -311,6 +313,7 @@
// TODO: Support long ints
// TODO: Support byteorder param (assumes 'little' at the moment)
// TODO: Support signed param (assumes signed=False at the moment)
+ (void)n_args;
// get the buffer info
mp_buffer_info_t bufinfo;
@@ -332,6 +335,7 @@
// TODO: Support long ints
// TODO: Support byteorder param (assumes 'little')
// TODO: Support signed param (assumes signed=False)
+ (void)n_args;
mp_int_t val = mp_obj_int_get_checked(args[0]);
mp_uint_t len = MP_OBJ_SMALL_INT_VALUE(args[1]);
diff --git a/py/objlist.c b/py/objlist.c
index de3be4c..ade062e 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -68,6 +68,7 @@
}
STATIC mp_obj_t list_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) {
diff --git a/py/objmap.c b/py/objmap.c
index ea62bb5..3225b4d 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -43,7 +43,7 @@
}
assert(n_args >= 2);
mp_obj_map_t *o = m_new_obj_var(mp_obj_map_t, mp_obj_t, n_args - 1);
- o->base.type = &mp_type_map;
+ o->base.type = type_in;
o->n_iters = n_args - 1;
o->fun = args[0];
for (mp_uint_t i = 0; i < n_args - 1; i++) {
diff --git a/py/objmodule.c b/py/objmodule.c
index d1d2293..0e806a7 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -34,6 +34,7 @@
#include "py/builtin.h"
STATIC void module_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_module_t *self = self_in;
const char *name = qstr_str(self->name);
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 320467e..a8d10c8 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -53,6 +53,7 @@
}
STATIC void namedtuple_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_namedtuple_t *o = o_in;
print(env, "%s(", qstr_str(o->tuple.base.type->name));
const mp_obj_t *fields = ((mp_obj_namedtuple_type_t*)o->tuple.base.type)->fields;
@@ -76,6 +77,9 @@
}
STATIC bool namedtuple_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
+ (void)self_in;
+ (void)attr;
+ (void)value;
nlr_raise(mp_obj_new_exception_msg(&mp_type_AttributeError, "can't set attribute"));
}
diff --git a/py/objnone.c b/py/objnone.c
index 387fb58..523158d 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -35,6 +35,7 @@
} mp_obj_none_t;
STATIC void none_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)self_in;
if (MICROPY_PY_UJSON && kind == PRINT_JSON) {
print(env, "null");
} else {
@@ -43,6 +44,7 @@
}
STATIC mp_obj_t none_unary_op(mp_uint_t op, mp_obj_t o_in) {
+ (void)o_in;
switch (op) {
case MP_UNARY_OP_BOOL: return mp_const_false;
default: return MP_OBJ_NULL; // op not supported
diff --git a/py/objobject.c b/py/objobject.c
index 5bbe02b..87295b7 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -37,17 +37,19 @@
} mp_obj_object_t;
STATIC mp_obj_t object_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)args;
if (n_args != 0 || n_kw != 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "object takes no arguments"));
}
mp_obj_object_t *o = m_new_obj(mp_obj_object_t);
- o->base.type = &mp_type_object;
+ o->base.type = type_in;
return o;
}
#if MICROPY_CPYTHON_COMPAT
STATIC mp_obj_t object___init__(mp_obj_t self) {
+ (void)self;
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___init___obj, object___init__);
diff --git a/py/objproperty.c b/py/objproperty.c
index 75cc145..3ec9092 100644
--- a/py/objproperty.c
+++ b/py/objproperty.c
@@ -41,7 +41,7 @@
mp_arg_check_num(n_args, n_kw, 0, 4, false);
mp_obj_property_t *o = m_new_obj(mp_obj_property_t);
- o->base.type = &mp_type_property;
+ o->base.type = type_in;
if (n_args >= 4) {
// doc ignored
}
diff --git a/py/objrange.c b/py/objrange.c
index 2a8388b..cc32701 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -80,6 +80,7 @@
} mp_obj_range_t;
STATIC void range_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_range_t *self = self_in;
print(env, "range(%d, %d", self->start, self->stop);
if (self->step == 1) {
@@ -93,7 +94,7 @@
mp_arg_check_num(n_args, n_kw, 1, 3, false);
mp_obj_range_t *o = m_new_obj(mp_obj_range_t);
- o->base.type = &mp_type_range;
+ o->base.type = type_in;
o->start = 0;
o->step = 1;
diff --git a/py/objreversed.c b/py/objreversed.c
index b614958..4ddb218 100644
--- a/py/objreversed.c
+++ b/py/objreversed.c
@@ -40,7 +40,7 @@
mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_obj_reversed_t *o = m_new_obj(mp_obj_reversed_t);
- o->base.type = &mp_type_reversed;
+ o->base.type = type_in;
o->seq = args[0];
o->cur_index = mp_obj_get_int(mp_obj_len(args[0])); // start at the end of the sequence
diff --git a/py/objset.c b/py/objset.c
index 54009a1..23acf83 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -80,6 +80,7 @@
}
STATIC void set_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_set_t *self = self_in;
#if MICROPY_PY_BUILTINS_FROZENSET
bool is_frozen = MP_OBJ_IS_TYPE(self_in, &mp_type_frozenset);
diff --git a/py/objslice.c b/py/objslice.c
index 3f090dc..4f3d054 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -39,6 +39,8 @@
} mp_obj_ellipsis_t;
STATIC void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)self_in;
+ (void)kind;
print(env, "Ellipsis");
}
@@ -65,6 +67,7 @@
} mp_obj_slice_t;
STATIC void slice_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_slice_t *o = o_in;
print(env, "slice(");
mp_obj_print_helper(print, env, o->start, PRINT_REPR);
diff --git a/py/objstr.c b/py/objstr.c
index 55d4cbf..2aea44b 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -132,6 +132,8 @@
#if !MICROPY_PY_BUILTINS_STR_UNICODE || MICROPY_CPYTHON_COMPAT
STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
+
#if MICROPY_CPYTHON_COMPAT
if (n_kw != 0) {
mp_arg_error_unimpl_kw();
@@ -171,6 +173,8 @@
#endif
STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
+
if (n_args == 0) {
return mp_const_empty_bytes;
}
diff --git a/py/objstringio.c b/py/objstringio.c
index eca8522..f7b8074 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -43,11 +43,13 @@
} mp_obj_stringio_t;
STATIC void stringio_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_stringio_t *self = self_in;
print(env, self->base.type == &mp_type_stringio ? "<io.StringIO 0x%x>" : "<io.BytesIO 0x%x>", self->vstr);
}
STATIC mp_uint_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+ (void)errcode;
mp_obj_stringio_t *o = o_in;
mp_uint_t remaining = o->vstr->len - o->pos;
if (size > remaining) {
@@ -59,6 +61,7 @@
}
STATIC mp_uint_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+ (void)errcode;
mp_obj_stringio_t *o = o_in;
mp_uint_t remaining = o->vstr->alloc - o->pos;
if (size > remaining) {
@@ -92,6 +95,7 @@
STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_close_obj, stringio_close);
STATIC mp_obj_t stringio___exit__(mp_uint_t n_args, const mp_obj_t *args) {
+ (void)n_args;
return stringio_close(args[0]);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stringio___exit___obj, 4, 4, stringio___exit__);
@@ -105,6 +109,7 @@
}
STATIC mp_obj_t stringio_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)n_kw; // TODO check n_kw==0
mp_obj_stringio_t *o = stringio_new(type_in);
if (n_args > 0) {
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index fd36787..49eddcc 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -114,6 +114,8 @@
}
STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
+
#if MICROPY_CPYTHON_COMPAT
if (n_kw != 0) {
mp_arg_error_unimpl_kw();
@@ -160,6 +162,7 @@
// be capped to the first/last character of the string, depending on is_slice.
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, mp_uint_t self_len,
mp_obj_t index, bool is_slice) {
+ (void)type;
mp_int_t i;
// Copied from mp_get_index; I don't want bounds checking, just give me
// the integer as-is. (I can't bounds-check without scanning the whole
diff --git a/py/objtuple.c b/py/objtuple.c
index 1f2eeb3..55358a6 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -62,6 +62,8 @@
}
STATIC mp_obj_t mp_obj_tuple_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
+
mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) {
diff --git a/py/objtype.c b/py/objtype.c
index 0db9850..8928de9 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -671,11 +671,14 @@
// - creating a new class (a new type) creates a new mp_obj_type_t
STATIC void type_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_type_t *self = self_in;
print(env, "<class '%s'>", qstr_str(self->name));
}
STATIC mp_obj_t type_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
+
mp_arg_check_num(n_args, n_kw, 1, 3, false);
switch (n_args) {
@@ -841,6 +844,7 @@
} mp_obj_super_t;
STATIC void super_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+ (void)kind;
mp_obj_super_t *self = self_in;
print(env, "<super: ");
mp_obj_print_helper(print, env, self->type, PRINT_STR);
@@ -850,6 +854,7 @@
}
STATIC mp_obj_t super_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+ (void)type_in;
if (n_args != 2 || n_kw != 0) {
// 0 arguments are turned into 2 in the compiler
// 1 argument is not yet implemented
diff --git a/py/objzip.c b/py/objzip.c
index e1bf927..68f9ed3 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -40,7 +40,7 @@
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, false);
mp_obj_zip_t *o = m_new_obj_var(mp_obj_zip_t, mp_obj_t, n_args);
- o->base.type = &mp_type_zip;
+ o->base.type = type_in;
o->n_iters = n_args;
for (mp_uint_t i = 0; i < n_args; i++) {
o->iters[i] = mp_getiter(args[i]);
diff --git a/py/parsenumbase.c b/py/parsenumbase.c
index 5574b3b..cb52405 100644
--- a/py/parsenumbase.c
+++ b/py/parsenumbase.c
@@ -29,6 +29,7 @@
// find real radix base, and strip preceding '0x', '0o' and '0b'
// puts base in *base, and returns number of bytes to skip the prefix
mp_uint_t mp_parse_num_base(const char *str, mp_uint_t len, mp_uint_t *base) {
+ (void)len; // TODO use given len?
const byte *p = (const byte*)str;
unichar c = *(p++);
if ((*base == 0 || *base == 16) && c == '0') {
diff --git a/py/pfenv.c b/py/pfenv.c
index f608a11..09ca0ef 100644
--- a/py/pfenv.c
+++ b/py/pfenv.c
@@ -179,6 +179,8 @@
}
int pfenv_print_mp_int(const pfenv_t *pfenv, mp_obj_t x, int sgn, int base, int base_char, int flags, char fill, int width, int prec) {
+ (void)sgn; // TODO why is sgn unused?
+
if (!MP_OBJ_IS_INT(x)) {
// This will convert booleans to int, or raise an error for
// non-integer types.
diff --git a/py/pfenv_printf.c b/py/pfenv_printf.c
index a68788a..d4c5fc9 100644
--- a/py/pfenv_printf.c
+++ b/py/pfenv_printf.c
@@ -196,6 +196,7 @@
}
void printf_wrapper(void *env, const char *fmt, ...) {
+ (void)env;
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
diff --git a/py/sequence.c b/py/sequence.c
index 8019e28..2781534 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -98,6 +98,8 @@
#endif
mp_obj_t mp_seq_extract_slice(mp_uint_t len, const mp_obj_t *seq, mp_bound_slice_t *indexes) {
+ (void)len; // TODO can we remove len from the arg list?
+
mp_int_t start = indexes->start, stop = indexes->stop;
mp_int_t step = indexes->step;