Commit 3a2171e4 authored by Damien George's avatar Damien George
Browse files

py: Eliminate some cases which trigger unused parameter warnings.

parent 42cec5c8
......@@ -55,8 +55,12 @@ mp_uint_t mp_decode_uint(const byte **ptr) {
STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, mp_uint_t expected, mp_uint_t given) {
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
// generic message, used also for other argument issues
(void)f;
(void)expected;
(void)given;
mp_arg_error_terse_mismatch();
#elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL
(void)f;
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
"function takes %d positional arguments but %d were given", expected, given));
#elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
......
......@@ -416,6 +416,9 @@ void mp_emit_bc_set_source_line(emit_t *emit, mp_uint_t source_line) {
emit->last_source_line_offset = emit->bytecode_offset;
emit->last_source_line = source_line;
}
#else
(void)emit;
(void)source_line;
#endif
}
......
......@@ -413,14 +413,16 @@ found:
// to point to the heap and may prevent other blocks from being reclaimed.
memset((byte*)ret_ptr + n_bytes, 0, (end_block - start_block + 1) * BYTES_PER_BLOCK - n_bytes);
#if MICROPY_ENABLE_FINALISER
#if MICROPY_ENABLE_FINALISER
if (has_finaliser) {
// clear type pointer in case it is never set
((mp_obj_base_t*)ret_ptr)->type = MP_OBJ_NULL;
// set mp_obj flag only if it has a finaliser
FTB_SET(start_block);
}
#endif
#else
(void)has_finaliser;
#endif
#if EXTENSIVE_HEAP_PROFILING
gc_dump_alloc_table();
......
......@@ -114,6 +114,7 @@ STATIC mp_obj_t mp_sys_print_exception(mp_uint_t n_args, const mp_obj_t *args) {
mp_print_t print = {stream_obj, (mp_print_strn_t)mp_stream_write};
mp_obj_print_exception(&print, args[0]);
#else
(void)n_args;
mp_obj_print_exception(&mp_plat_print, args[0]);
#endif
......
......@@ -488,6 +488,8 @@ STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_ui
}
bufinfo->buf = (uint8_t*)bufinfo->buf + (mp_uint_t)o->free * sz;
}
#else
(void)flags;
#endif
return 0;
}
......
......@@ -57,6 +57,7 @@ STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t
o->iter = mp_getiter(vals[0].u_obj);
o->cur = vals[1].u_int;
#else
(void)n_kw;
mp_obj_enumerate_t *o = m_new_obj(mp_obj_enumerate_t);
o->base.type = type_in;
o->iter = mp_getiter(args[0]);
......
......@@ -172,11 +172,13 @@ mp_obj_t mp_obj_str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
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 MICROPY_CPYTHON_COMPAT
#if MICROPY_CPYTHON_COMPAT
if (n_kw != 0) {
mp_arg_error_unimpl_kw();
}
#endif
#else
(void)n_kw;
#endif
if (n_args == 0) {
return mp_const_empty_bytes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment