Skip to content

Commit 3a2171e

Browse files
committed
py: Eliminate some cases which trigger unused parameter warnings.
1 parent 42cec5c commit 3a2171e

7 files changed

Lines changed: 19 additions & 4 deletions

File tree

py/bc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ mp_uint_t mp_decode_uint(const byte **ptr) {
5555
STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, mp_uint_t expected, mp_uint_t given) {
5656
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
5757
// generic message, used also for other argument issues
58+
(void)f;
59+
(void)expected;
60+
(void)given;
5861
mp_arg_error_terse_mismatch();
5962
#elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL
63+
(void)f;
6064
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError,
6165
"function takes %d positional arguments but %d were given", expected, given));
6266
#elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED

py/emitbc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ void mp_emit_bc_set_source_line(emit_t *emit, mp_uint_t source_line) {
416416
emit->last_source_line_offset = emit->bytecode_offset;
417417
emit->last_source_line = source_line;
418418
}
419+
#else
420+
(void)emit;
421+
(void)source_line;
419422
#endif
420423
}
421424

py/gc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,16 @@ void *gc_alloc(mp_uint_t n_bytes, bool has_finaliser) {
413413
// to point to the heap and may prevent other blocks from being reclaimed.
414414
memset((byte*)ret_ptr + n_bytes, 0, (end_block - start_block + 1) * BYTES_PER_BLOCK - n_bytes);
415415

416-
#if MICROPY_ENABLE_FINALISER
416+
#if MICROPY_ENABLE_FINALISER
417417
if (has_finaliser) {
418418
// clear type pointer in case it is never set
419419
((mp_obj_base_t*)ret_ptr)->type = MP_OBJ_NULL;
420420
// set mp_obj flag only if it has a finaliser
421421
FTB_SET(start_block);
422422
}
423-
#endif
423+
#else
424+
(void)has_finaliser;
425+
#endif
424426

425427
#if EXTENSIVE_HEAP_PROFILING
426428
gc_dump_alloc_table();

py/modsys.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ STATIC mp_obj_t mp_sys_print_exception(mp_uint_t n_args, const mp_obj_t *args) {
114114
mp_print_t print = {stream_obj, (mp_print_strn_t)mp_stream_write};
115115
mp_obj_print_exception(&print, args[0]);
116116
#else
117+
(void)n_args;
117118
mp_obj_print_exception(&mp_plat_print, args[0]);
118119
#endif
119120

py/objarray.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_ui
488488
}
489489
bufinfo->buf = (uint8_t*)bufinfo->buf + (mp_uint_t)o->free * sz;
490490
}
491+
#else
492+
(void)flags;
491493
#endif
492494
return 0;
493495
}

py/objenumerate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t
5757
o->iter = mp_getiter(vals[0].u_obj);
5858
o->cur = vals[1].u_int;
5959
#else
60+
(void)n_kw;
6061
mp_obj_enumerate_t *o = m_new_obj(mp_obj_enumerate_t);
6162
o->base.type = type_in;
6263
o->iter = mp_getiter(args[0]);

py/objstr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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,
172172
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) {
173173
(void)type_in;
174174

175-
#if MICROPY_CPYTHON_COMPAT
175+
#if MICROPY_CPYTHON_COMPAT
176176
if (n_kw != 0) {
177177
mp_arg_error_unimpl_kw();
178178
}
179-
#endif
179+
#else
180+
(void)n_kw;
181+
#endif
180182

181183
if (n_args == 0) {
182184
return mp_const_empty_bytes;

0 commit comments

Comments
 (0)