Skip to content

Commit ff8dd3f

Browse files
committed
py, unix: Allow to compile with -Wunused-parameter.
See issue adafruit#699.
1 parent 50912e7 commit ff8dd3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+156
-19
lines changed

extmod/modubinascii.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#if MICROPY_PY_UBINASCII
3636

3737
STATIC mp_obj_t mod_binascii_hexlify(mp_uint_t n_args, const mp_obj_t *args) {
38+
(void)n_args;
3839
mp_buffer_info_t bufinfo;
3940
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
4041

extmod/moductypes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ STATIC NORETURN void syntax_error(void) {
122122
}
123123

124124
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) {
125+
(void)n_kw;
125126
if (n_args < 2 || n_args > 3) {
126127
syntax_error();
127128
}
@@ -137,6 +138,7 @@ STATIC mp_obj_t uctypes_struct_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_u
137138
}
138139

139140
STATIC void uctypes_struct_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
141+
(void)kind;
140142
mp_obj_uctypes_struct_t *self = self_in;
141143
const char *typen = "unk";
142144
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)) {

extmod/moduhashlib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ STATIC mp_obj_t hash_digest(mp_obj_t self_in) {
7171
MP_DEFINE_CONST_FUN_OBJ_1(hash_digest_obj, hash_digest);
7272

7373
STATIC mp_obj_t hash_hexdigest(mp_obj_t self_in) {
74+
(void)self_in;
7475
mp_not_implemented("");
7576
#if 0
7677
mp_obj_hash_t *self = self_in;

extmod/modure.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ typedef struct _mp_obj_match_t {
5252

5353

5454
STATIC void match_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
55+
(void)kind;
5556
mp_obj_match_t *self = self_in;
5657
print(env, "<match num=%d @%p>", self->num_matches);
5758
}
@@ -82,11 +83,13 @@ STATIC const mp_obj_type_t match_type = {
8283
};
8384

8485
STATIC void re_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
86+
(void)kind;
8587
mp_obj_re_t *self = self_in;
8688
print(env, "<re %p>", self);
8789
}
8890

8991
STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
92+
(void)n_args;
9093
mp_obj_re_t *self = args[0];
9194
Subject subj;
9295
mp_uint_t len;
@@ -192,6 +195,7 @@ STATIC mp_obj_t mod_re_compile(uint n_args, const mp_obj_t *args) {
192195
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_compile_obj, 1, 2, mod_re_compile);
193196

194197
STATIC mp_obj_t mod_re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
198+
(void)n_args;
195199
mp_obj_re_t *self = mod_re_compile(1, args);
196200

197201
const mp_obj_t args2[] = {self, args[1]};

extmod/moduzlib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ STATIC int mod_uzlib_grow_buf(TINF_DATA *d, unsigned alloc_req) {
5555
}
5656

5757
STATIC mp_obj_t mod_uzlib_decompress(mp_uint_t n_args, const mp_obj_t *args) {
58+
(void)n_args;
5859
mp_obj_t data = args[0];
5960
mp_buffer_info_t bufinfo;
6061
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);

py/asmx86.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ void asm_x86_start_pass(asm_x86_t *as, mp_uint_t pass) {
145145
}
146146

147147
void asm_x86_end_pass(asm_x86_t *as) {
148+
(void)as;
148149
}
149150

150151
// all functions must go through this one to emit bytes

py/builtinevex.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_t globals, mp_obj_t loc
7575
}
7676

7777
STATIC mp_obj_t mp_builtin_compile(mp_uint_t n_args, const mp_obj_t *args) {
78+
(void)n_args;
79+
7880
// get the source
7981
mp_uint_t str_len;
8082
const char *str = mp_obj_str_get_data(args[0], &str_len);

py/compile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,6 +3210,9 @@ STATIC void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) {
32103210
EMIT_ARG(store_id, MP_QSTR___doc__);
32113211
}
32123212
}
3213+
#else
3214+
(void)comp;
3215+
(void)pn;
32133216
#endif
32143217
}
32153218

@@ -3514,7 +3517,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
35143517
}
35153518
#endif
35163519

3517-
STATIC void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
3520+
STATIC void scope_compute_things(scope_t *scope) {
35183521
#if !MICROPY_EMIT_CPYTHON
35193522
// in Micro Python we put the *x parameter after all other parameters (except **y)
35203523
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
36783681

36793682
// compute some things related to scope and identifiers
36803683
for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) {
3681-
compile_scope_compute_things(comp, s);
3684+
scope_compute_things(s);
36823685
}
36833686

36843687
// finish with pass 1

py/emitbc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ STATIC void emit_write_bytecode_byte_signed_label(emit_t* emit, byte b1, mp_uint
268268
}
269269

270270
STATIC void emit_bc_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t arg1, qstr arg2) {
271+
(void)emit;
272+
(void)op;
273+
(void)arg1;
274+
(void)arg2;
271275
}
272276

273277
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) {
499503
};
500504

501505
STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
506+
(void)qst;
502507
assert(local_num >= 0);
503508
emit_bc_pre(emit, 1);
504509
if (local_num <= 15) {
@@ -509,11 +514,13 @@ STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
509514
}
510515

511516
STATIC void emit_bc_load_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
517+
(void)qst;
512518
emit_bc_pre(emit, 1);
513519
emit_write_bytecode_byte_uint(emit, MP_BC_LOAD_DEREF, local_num);
514520
}
515521

516522
STATIC void emit_bc_load_name(emit_t *emit, qstr qst) {
523+
(void)qst;
517524
emit_bc_pre(emit, 1);
518525
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_NAME, qst);
519526
if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
@@ -522,6 +529,7 @@ STATIC void emit_bc_load_name(emit_t *emit, qstr qst) {
522529
}
523530

524531
STATIC void emit_bc_load_global(emit_t *emit, qstr qst) {
532+
(void)qst;
525533
emit_bc_pre(emit, 1);
526534
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_GLOBAL, qst);
527535
if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
@@ -553,6 +561,7 @@ STATIC void emit_bc_load_subscr(emit_t *emit) {
553561
}
554562

555563
STATIC void emit_bc_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
564+
(void)qst;
556565
assert(local_num >= 0);
557566
emit_bc_pre(emit, -1);
558567
if (local_num <= 15) {
@@ -563,6 +572,7 @@ STATIC void emit_bc_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
563572
}
564573

565574
STATIC void emit_bc_store_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
575+
(void)qst;
566576
emit_bc_pre(emit, -1);
567577
emit_write_bytecode_byte_uint(emit, MP_BC_STORE_DEREF, local_num);
568578
}
@@ -591,10 +601,12 @@ STATIC void emit_bc_store_subscr(emit_t *emit) {
591601
}
592602

593603
STATIC void emit_bc_delete_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
604+
(void)qst;
594605
emit_write_bytecode_byte_uint(emit, MP_BC_DELETE_FAST, local_num);
595606
}
596607

597608
STATIC void emit_bc_delete_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
609+
(void)qst;
598610
emit_write_bytecode_byte_uint(emit, MP_BC_DELETE_DEREF, local_num);
599611
}
600612

py/emitglue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void
9292
fwrite(fun_data, fun_len, 1, fp_write_code);
9393
fclose(fp_write_code);
9494
#endif
95+
#else
96+
(void)fun_len;
9597
#endif
9698
}
9799
#endif

0 commit comments

Comments
 (0)