diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index 57aa2c2ce2..de8b5d9aeb 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -35,6 +35,7 @@ #if MICROPY_PY_UBINASCII STATIC mp_obj_t mod_binascii_hexlify(mp_uint_t n_args, const mp_obj_t *args) { + (void)n_args; mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ); diff --git a/extmod/moductypes.c b/extmod/moductypes.c index 923d34488e..7e7128a269 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -122,6 +122,7 @@ STATIC NORETURN void syntax_error(void) { } STATIC mp_obj_t uctypes_struct_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; if (n_args < 2 || n_args > 3) { syntax_error(); } @@ -137,6 +138,7 @@ STATIC mp_obj_t uctypes_struct_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_u } STATIC void uctypes_struct_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_uctypes_struct_t *self = self_in; const char *typen = "unk"; if (MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)) { diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index d4d05c3e95..40a0f06094 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -71,6 +71,7 @@ STATIC mp_obj_t hash_digest(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(hash_digest_obj, hash_digest); STATIC mp_obj_t hash_hexdigest(mp_obj_t self_in) { + (void)self_in; mp_not_implemented(""); #if 0 mp_obj_hash_t *self = self_in; diff --git a/extmod/modure.c b/extmod/modure.c index fa7ae67740..d192585f5d 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -52,6 +52,7 @@ typedef struct _mp_obj_match_t { STATIC void match_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_match_t *self = self_in; print(env, "", self->num_matches); } @@ -82,11 +83,13 @@ STATIC const mp_obj_type_t match_type = { }; STATIC void re_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_re_t *self = self_in; print(env, "", self); } STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) { + (void)n_args; mp_obj_re_t *self = args[0]; Subject subj; mp_uint_t len; @@ -192,6 +195,7 @@ STATIC mp_obj_t mod_re_compile(uint n_args, const mp_obj_t *args) { MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_compile_obj, 1, 2, mod_re_compile); STATIC mp_obj_t mod_re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) { + (void)n_args; mp_obj_re_t *self = mod_re_compile(1, args); const mp_obj_t args2[] = {self, args[1]}; diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index 680b5c1b8e..821f300dab 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -55,6 +55,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) { } STATIC mp_obj_t mod_uzlib_decompress(mp_uint_t n_args, const mp_obj_t *args) { + (void)n_args; mp_obj_t data = args[0]; mp_buffer_info_t bufinfo; mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ); diff --git a/py/asmx86.c b/py/asmx86.c index 755ed03075..11107f1daa 100644 --- a/py/asmx86.c +++ b/py/asmx86.c @@ -145,6 +145,7 @@ void asm_x86_start_pass(asm_x86_t *as, mp_uint_t pass) { } 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 9bca4a0f53..85ffbf4e65 100644 --- a/py/builtinevex.c +++ b/py/builtinevex.c @@ -75,6 +75,8 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_t globals, mp_obj_t loc } 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 8d246c3758..ea0782e3c2 100644 --- a/py/compile.c +++ b/py/compile.c @@ -3210,6 +3210,9 @@ STATIC void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) { EMIT_ARG(store_id, MP_QSTR___doc__); } } +#else + (void)comp; + (void)pn; #endif } @@ -3514,7 +3517,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind } #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 @@ mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is // 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 1ac49ac270..f7f2b8d194 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -268,6 +268,10 @@ STATIC void emit_write_bytecode_byte_signed_label(emit_t* emit, byte b1, mp_uint } 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_null(emit_t *emit) { }; 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_fast(emit_t *emit, qstr qst, mp_uint_t local_num) { } 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_name(emit_t *emit, qstr qst) { } 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_load_subscr(emit_t *emit) { } 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_fast(emit_t *emit, qstr qst, mp_uint_t local_num) { } 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_store_subscr(emit_t *emit) { } 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 587c738ac9..7064cb8f27 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -92,6 +92,8 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void 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 a8e547f0d3..0721636185 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -740,6 +740,8 @@ STATIC void emit_native_adjust_stack_size(emit_t *emit, mp_int_t delta) { } 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_pre_pop_reg_reg_reg(emit_t *emit, vtype_kind_t *vtypea, int reg } 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_fast(emit_t *emit, qstr qst, mp_uint_t local_num) { 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_fast(emit_t *emit, qstr qst, mp_uint_t local_num) 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 @@ STATIC void emit_native_delete_fast(emit_t *emit, qstr qst, mp_uint_t local_num) // 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 @@ STATIC void emit_native_jump(emit_t *emit, mp_uint_t label) { 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_jump_helper(emit_t *emit, mp_uint_t label, bool pop) { 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_true_or_pop(emit_t *emit, mp_uint_t label) { 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_block(emit_t *emit) { } 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_function(emit_t *emit, scope_t *scope, mp_uint_t n_ } 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_raise_varargs(emit_t *emit, mp_uint_t n_args) { 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 941f34dafb..c6d92783ae 100644 --- a/py/emitpass1.c +++ b/py/emitpass1.c @@ -42,6 +42,7 @@ void emit_pass1_free(emit_t *emit) { } 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_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope } 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 e6adc355b1..7d1b6bf38b 100644 --- a/py/modmicropython.c +++ b/py/modmicropython.c @@ -54,6 +54,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem #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 @@ mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) { // 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 ad7414ab0e..f5b9540a7d 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -198,10 +198,10 @@ STATIC mp_uint_t mpn_sub(mpz_dig_t *idig, const mpz_dig_t *jdig, mp_uint_t jlen, /* 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 @@ void mpz_and_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs) { } // 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 2634190dd3..25d9daea97 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -77,6 +77,7 @@ STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_ui #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 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) { #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 @@ STATIC mp_obj_t array_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k #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 6dd9e7f9f8..d60dc8c0bd 100644 --- a/py/objbool.c +++ b/py/objbool.c @@ -53,6 +53,7 @@ STATIC void bool_print(void (*print)(void *env, const char *fmt, ...), void *env } 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 e451ce4c13..7698ed29f1 100644 --- a/py/objboundmeth.c +++ b/py/objboundmeth.c @@ -37,6 +37,7 @@ typedef struct _mp_obj_bound_meth_t { #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, "self, PRINT_REPR); diff --git a/py/objcell.c b/py/objcell.c index b2d42001bc..9e43d7fb27 100644 --- a/py/objcell.c +++ b/py/objcell.c @@ -43,6 +43,7 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) { #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, "obj); if (o->obj == MP_OBJ_NULL) { diff --git a/py/objclosure.c b/py/objclosure.c index 853f0930c0..95c1adde0c 100644 --- a/py/objclosure.c +++ b/py/objclosure.c @@ -61,6 +61,7 @@ STATIC mp_obj_t closure_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, #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, "fun, PRINT_REPR); diff --git a/py/objcomplex.c b/py/objcomplex.c index 3af98e4b21..027292a17a 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -49,6 +49,7 @@ typedef struct _mp_obj_complex_t { } 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 void complex_print(void (*print)(void *env, const char *fmt, ...), void * } 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 900ecf4eb2..e97f30e7a2 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -74,6 +74,7 @@ STATIC void dict_print(void (*print)(void *env, const char *fmt, ...), void *env } 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 mp_obj_t dict_view_getiter(mp_obj_t view_in) { } 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 209af82312..ab1153844d 100644 --- a/py/objenumerate.c +++ b/py/objenumerate.c @@ -51,12 +51,12 @@ STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t // 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 98200f2608..c9ded8d7f4 100644 --- a/py/objfilter.c +++ b/py/objfilter.c @@ -39,7 +39,7 @@ STATIC mp_obj_t filter_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_ } 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 86b672007e..4323cec54c 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 void float_print(void (*print)(void *env, const char *fmt, ...), void *en } 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 8f835726d4..28706cc687 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -116,6 +116,7 @@ const char *mp_obj_fun_get_name(mp_const_obj_t fun_in) { #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, "", mp_obj_fun_get_name(o), o); } diff --git a/py/objgenerator.c b/py/objgenerator.c index a4d22aa8de..e67824dd7e 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -95,6 +95,7 @@ mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) { /* 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, "", mp_obj_code_get_name(self->code_state.code_info), self_in); } diff --git a/py/objint.c b/py/objint.c index f1bd5dad7d..049d0410ea 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 @@ STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_ } 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 @@ STATIC mp_obj_t int_from_bytes(mp_uint_t n_args, const mp_obj_t *args) { // 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 @@ STATIC mp_obj_t int_to_bytes(mp_uint_t n_args, const mp_obj_t *args) { // 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 de3be4c864..ade062e07c 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -68,6 +68,7 @@ STATIC mp_obj_t list_extend_from_iter(mp_obj_t list, mp_obj_t iterable) { } 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 ea62bb512f..3225b4dc93 100644 --- a/py/objmap.c +++ b/py/objmap.c @@ -43,7 +43,7 @@ STATIC mp_obj_t map_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, } 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 d1d2293a21..0e806a7054 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 320467eed5..a8d10c8e01 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -53,6 +53,7 @@ STATIC mp_uint_t namedtuple_find_field(mp_obj_namedtuple_type_t *type, qstr name } 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 void namedtuple_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { } 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 387fb58cb6..523158d00e 100644 --- a/py/objnone.c +++ b/py/objnone.c @@ -35,6 +35,7 @@ typedef struct _mp_obj_none_t { } 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 void none_print(void (*print)(void *env, const char *fmt, ...), void *env } 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 5bbe02b328..87295b765b 100644 --- a/py/objobject.c +++ b/py/objobject.c @@ -37,17 +37,19 @@ typedef struct _mp_obj_object_t { } 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 75cc1458ea..3ec9092365 100644 --- a/py/objproperty.c +++ b/py/objproperty.c @@ -41,7 +41,7 @@ STATIC mp_obj_t property_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t 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 2a8388b172..cc32701597 100644 --- a/py/objrange.c +++ b/py/objrange.c @@ -80,6 +80,7 @@ typedef struct _mp_obj_range_t { } 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 @@ STATIC mp_obj_t range_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k 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 b614958611..4ddb218074 100644 --- a/py/objreversed.c +++ b/py/objreversed.c @@ -40,7 +40,7 @@ STATIC mp_obj_t reversed_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t 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 54009a1f53..23acf831a6 100644 --- a/py/objset.c +++ b/py/objset.c @@ -80,6 +80,7 @@ STATIC void check_set(mp_obj_t o) { } 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 3f090dc237..4f3d054c68 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -39,6 +39,8 @@ typedef struct _mp_obj_ellipsis_t { } 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 @@ typedef struct _mp_obj_slice_t { } 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 55d4cbf732..2aea44b683 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -132,6 +132,8 @@ STATIC void str_print(void (*print)(void *env, const char *fmt, ...), void *env, #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 @@ STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, #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 eca8522eef..f7b8074f35 100644 --- a/py/objstringio.c +++ b/py/objstringio.c @@ -43,11 +43,13 @@ typedef struct _mp_obj_stringio_t { } 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 ? "" : "", 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_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er } 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_obj_t stringio_close(mp_obj_t self_in) { 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_stringio_t *stringio_new(mp_obj_t type_in) { } 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 fd3678722c..49eddcca3f 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -114,6 +114,8 @@ STATIC mp_obj_t uni_unary_op(mp_uint_t op, mp_obj_t self_in) { } 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 @@ STATIC mp_obj_t str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, // 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 1f2eeb380d..55358a66a0 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -62,6 +62,8 @@ void mp_obj_tuple_print(void (*print)(void *env, const char *fmt, ...), void *en } 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 0db98508c5..8928de9417 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -671,11 +671,14 @@ STATIC mp_obj_t instance_getiter(mp_obj_t self_in) { // - 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, "", 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 @@ typedef struct _mp_obj_super_t { } 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, "type, PRINT_STR); @@ -850,6 +854,7 @@ STATIC void super_print(void (*print)(void *env, const char *fmt, ...), void *en } 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 e1bf92737a..68f9ed3f39 100644 --- a/py/objzip.c +++ b/py/objzip.c @@ -40,7 +40,7 @@ STATIC mp_obj_t zip_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, 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 5574b3b9b5..cb524057f7 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 f608a11752..09ca0ef80e 100644 --- a/py/pfenv.c +++ b/py/pfenv.c @@ -179,6 +179,8 @@ int pfenv_print_int(const pfenv_t *pfenv, mp_uint_t x, int sgn, int base, int ba } 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 a68788a7f6..d4c5fc9df5 100644 --- a/py/pfenv_printf.c +++ b/py/pfenv_printf.c @@ -196,6 +196,7 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, ...) { } 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 8019e28bd8..27815344e3 100644 --- a/py/sequence.c +++ b/py/sequence.c @@ -98,6 +98,8 @@ bool mp_seq_get_fast_slice_indexes(mp_uint_t len, mp_obj_t slice, mp_bound_slice #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; diff --git a/unix/file.c b/unix/file.c index a2706a96c5..6688028a4c 100644 --- a/unix/file.c +++ b/unix/file.c @@ -61,6 +61,7 @@ extern const mp_obj_type_t mp_type_fileio; extern const mp_obj_type_t mp_type_textio; STATIC void fdfile_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_fdfile_t *self = self_in; print(env, "", mp_obj_get_type_str(self), self->fd); } @@ -123,6 +124,7 @@ STATIC mp_obj_t fdfile_close(mp_obj_t self_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_close_obj, fdfile_close); STATIC mp_obj_t fdfile___exit__(mp_uint_t n_args, const mp_obj_t *args) { + (void)n_args; return fdfile_close(args[0]); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fdfile___exit___obj, 4, 4, fdfile___exit__); diff --git a/unix/modffi.c b/unix/modffi.c index 5f33e7721b..fc218caf17 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -161,6 +161,7 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type) // FFI module STATIC void ffimod_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_ffimod_t *self = self_in; print(env, "", self->handle); } @@ -173,6 +174,7 @@ STATIC mp_obj_t ffimod_close(mp_obj_t self_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(ffimod_close_obj, ffimod_close); STATIC mp_obj_t ffimod_func(mp_uint_t n_args, const mp_obj_t *args) { + (void)n_args; // always 4 mp_obj_ffimod_t *self = args[0]; const char *rettype = mp_obj_str_get_str(args[1]); const char *symname = mp_obj_str_get_str(args[2]); @@ -267,6 +269,9 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna MP_DEFINE_CONST_FUN_OBJ_3(ffimod_var_obj, ffimod_var); STATIC mp_obj_t ffimod_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { + (void)n_args; + (void)n_kw; + const char *fname = mp_obj_str_get_str(args[0]); void *mod = dlopen(fname, RTLD_NOW | RTLD_LOCAL); @@ -298,6 +303,7 @@ STATIC const mp_obj_type_t ffimod_type = { // FFI function STATIC void ffifunc_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_ffifunc_t *self = self_in; print(env, "", self->func); } @@ -366,6 +372,7 @@ STATIC const mp_obj_type_t ffifunc_type = { // FFI callback for Python function STATIC void fficallback_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_fficallback_t *self = self_in; print(env, "", self->func); } @@ -379,6 +386,7 @@ STATIC const mp_obj_type_t fficallback_type = { // FFI variable STATIC void ffivar_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_ffivar_t *self = self_in; // Variable value printed as cast to int print(env, "", self->var, *(int*)self->var); diff --git a/unix/modsocket.c b/unix/modsocket.c index 3982650f1b..8f6ac26c6d 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -83,6 +83,7 @@ STATIC mp_obj_socket_t *socket_new(int fd) { STATIC void socket_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; mp_obj_socket_t *self = self_in; print(env, "<_socket %d>", self->fd); } @@ -206,6 +207,7 @@ STATIC mp_obj_t socket_send(mp_uint_t n_args, const mp_obj_t *args) { STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_send_obj, 2, 3, socket_send); STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) { + (void)n_args; // always 4 mp_obj_socket_t *self = args[0]; int level = MP_OBJ_SMALL_INT_VALUE(args[1]); int option = mp_obj_get_int(args[2]); @@ -259,6 +261,9 @@ STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) { STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile); STATIC mp_obj_t socket_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; + (void)n_kw; + int family = AF_INET; int type = SOCK_STREAM; int proto = 0;