summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-04-05 19:31:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-04-05 19:31:04 -0700
commit858ce927fc30d080793fffe42b0ce6fcddfbb3c5 (patch)
tree4be9082f8d3243ff23414aaaefa15db7a3708c80
parent579a30ef3f8a6656c4db38d43c34f4dc3403af33 (diff)
downloadtxr-858ce927fc30d080793fffe42b0ce6fcddfbb3c5.tar.gz
txr-858ce927fc30d080793fffe42b0ce6fcddfbb3c5.tar.bz2
txr-858ce927fc30d080793fffe42b0ce6fcddfbb3c5.zip
warning cleanup: remove unused parameters.
This is the second round of an effort to enable GCC's -Wextra option. All function parameters that are unused and are removable are removed. They are eliminated from the function defintions, declarations, callers, and any related function pointer variables or structure members. * arith.c (nary_simple_op): Remove unused self parameter. See lib.c: maxv, minv. * chksum.c (crc32_buf, crc32_str): Remove unused self parameter. (crc32): Don't pass self to the above functions. * eval.c (copy_env_handler, copy_bh_env_handler): Remove unused parent parameter. See unwind.c. (supplement_op_syms): Remove unused max parameter. (me_op): Don't pass max to supplement_op_syms. * lib.c (seq_iter_rewind): Remove unused self parameter. (lazy_flatten_func): Remove unused env parameter. (lazy_flatten): Use func_n1 to create non-environment-carrying funtion out of lazy_flatten_func. (maxv, minv): Don't pass self parameter to nary_simple_op. (middle_pivot): Remove unused lessfun param. (quicksort): Don't pass lessfun to middle_pivot. (diff, isec): Don't pass self to seq_iter_rewind. * lib.h (seq_iter_rewind, nary_simple_op): Declarations updated. * struct.c (get_super_slots): Remove unused self parameteer. (make_struct_type): Don't pass self to get_super_slots. * sysif.c (flock_unpack): Remove unused self parameter. (fcntl_wrap): Don't pass self to flock_unpack. * unwind.c (uw_push_cont_copy): Remove parent parameter from function pointer parameter. See eval.c: copy_env_handler. (call_copy_handlers): Remove parent parameter and don't pass that argument to the indirect call via pointer to the copy handler function. (revive_cont, capture_cont): Don't pass 0 value to removed parent parameter of call_copy_handlers. * unwind.h (struct uw_cont_copy): Function pointer member copy loses parent parameter. (uw_push_cont_copy): Declaration updated.
-rw-r--r--arith.c2
-rw-r--r--chksum.c8
-rw-r--r--eval.c8
-rw-r--r--lib.c18
-rw-r--r--lib.h4
-rw-r--r--struct.c4
-rw-r--r--sysif.c4
-rw-r--r--unwind.c10
-rw-r--r--unwind.h4
9 files changed, 31 insertions, 31 deletions
diff --git a/arith.c b/arith.c
index ed559a26..e805b9de 100644
--- a/arith.c
+++ b/arith.c
@@ -4114,7 +4114,7 @@ static val nary_op_keyfun(val self, val (*bfun)(val, val),
}
-val nary_simple_op(val self, val (*bfun)(val, val),
+val nary_simple_op(val (*bfun)(val, val),
struct args *args, val firstval)
{
val acc = firstval, next;
diff --git a/chksum.c b/chksum.c
index b4404c31..63d2c7bd 100644
--- a/chksum.c
+++ b/chksum.c
@@ -285,7 +285,7 @@ val crc32_stream(val stream, val nbytes)
return unum(crc);
}
-static val crc32_buf(val buf, val self)
+static val crc32_buf(val buf)
{
ucnum len = c_unum(buf->b.len);
mem_t *data = buf->b.data;
@@ -304,7 +304,7 @@ static val crc32_buf(val buf, val self)
return unum(crc);
}
-static val crc32_str(val str, val self)
+static val crc32_str(val str)
{
val s = make_byte_input_stream(str);
return crc32_stream(s, nil);
@@ -319,9 +319,9 @@ val crc32(val obj)
case STR:
case LSTR:
case LIT:
- return crc32_str(obj, self);
+ return crc32_str(obj);
case BUF:
- return crc32_buf(obj, self);
+ return crc32_buf(obj);
default:
uw_throwf(error_s, lit("~a: cannot hash ~s, only buffer and strings"),
self, obj, nao);
diff --git a/eval.c b/eval.c
index 36ec85b3..997ddf08 100644
--- a/eval.c
+++ b/eval.c
@@ -785,7 +785,7 @@ static val special_var_p(val sym)
if2(lisplib_try_load(sym), gethash(special, sym)));
}
-static void copy_env_handler(mem_t *ptr, int parent)
+static void copy_env_handler(mem_t *ptr)
{
val *penv = coerce(val *, ptr);
*penv = copy_env(*penv);
@@ -1681,7 +1681,7 @@ struct bindings_helper_vars {
val ne;
};
-static void copy_bh_env_handler(mem_t *ptr, int parent)
+static void copy_bh_env_handler(mem_t *ptr)
{
struct bindings_helper_vars *pv = coerce(struct bindings_helper_vars *, ptr);
pv->ne = copy_env(pv->ne);
@@ -3848,7 +3848,7 @@ static val cons_find(val obj, val structure, val test)
cons_find(obj, cdr(structure), test));
}
-static val supplement_op_syms(val ssyms, val max)
+static val supplement_op_syms(val ssyms)
{
list_collect_decl (outsyms, tl);
val si, ni;
@@ -3892,7 +3892,7 @@ static val me_op(val form, val menv)
sym, max, nao);
if (!eql(max, length(nums)) && !zerop(min))
- ssyms = supplement_op_syms(ssyms, max);
+ ssyms = supplement_op_syms(ssyms);
rlcp(body_trans, body);
diff --git a/lib.c b/lib.c
index bcfb9638..1f8fadff 100644
--- a/lib.c
+++ b/lib.c
@@ -396,7 +396,7 @@ val seq_geti(seq_iter_t *it)
return v;
}
-void seq_iter_rewind(val self, seq_iter_t *it)
+void seq_iter_rewind(seq_iter_t *it)
{
switch (it->inf.kind) {
case SEQ_NIL:
@@ -2287,7 +2287,7 @@ static val lazy_flatten_scan(val list, val *escape)
}
}
-static val lazy_flatten_func(val env, val lcons)
+static val lazy_flatten_func(val lcons)
{
us_cons_bind (list, escape, lcons);
val atom = car(list);
@@ -2314,7 +2314,7 @@ val lazy_flatten(val list)
if (!next)
return nil;
- return make_lazy_cons_car_cdr(func_f1(nil, lazy_flatten_func),
+ return make_lazy_cons_car_cdr(func_n1(lazy_flatten_func),
next, escape);
}
}
@@ -3436,12 +3436,12 @@ val min2(val a, val b)
val maxv(val first, struct args *rest)
{
- return nary_simple_op(lit("max"), max2, rest, first);
+ return nary_simple_op(max2, rest, first);
}
val minv(val first, struct args *rest)
{
- return nary_simple_op(lit("min"), min2, rest, first);
+ return nary_simple_op(min2, rest, first);
}
val maxl(val first, val rest)
@@ -8795,7 +8795,7 @@ static cnum med_of_three(val vec, val lessfun, val keyfun, cnum from, cnum to,
}
}
-static cnum middle_pivot(val vec, val lessfun, val keyfun, cnum from, cnum to,
+static cnum middle_pivot(val vec, val keyfun, cnum from, cnum to,
val *pkval)
{
cnum pivot = from + (to - from) / 2;
@@ -8811,7 +8811,7 @@ static void quicksort(val vec, val lessfun, val keyfun, cnum from, cnum to)
cnum i, j;
cnum pivot = if3(to - from > 15,
med_of_three(vec, lessfun, keyfun, from, to, &pkval),
- middle_pivot(vec, lessfun, keyfun, from, to, &pkval));
+ middle_pivot(vec, keyfun, from, to, &pkval));
swap(vec, num_fast(pivot), num_fast(to - 1));
@@ -10159,7 +10159,7 @@ val diff(val seq1, val seq2, val testfun, val keyfun)
val el2;
int found = 0;
- seq_iter_rewind(self, &si2);
+ seq_iter_rewind(&si2);
while (seq_get(&si2, &el2)) {
val el2_key = funcall1(keyfun, el2);
@@ -10265,7 +10265,7 @@ val isec(val seq1, val seq2, val testfun, val keyfun)
val el1_key = funcall1(keyfun, el1);
val el2;
- seq_iter_rewind(self, &si2);
+ seq_iter_rewind(&si2);
while (seq_get(&si2, &el2)) {
val el2_key = funcall1(keyfun, el2);
diff --git a/lib.h b/lib.h
index 115b11d2..b4e2554f 100644
--- a/lib.h
+++ b/lib.h
@@ -547,7 +547,7 @@ val subtypep(val sub, val sup);
val typep(val obj, val type);
seq_info_t seq_info(val cobj);
void seq_iter_init(val self, seq_iter_t *it, val obj);
-void seq_iter_rewind(val self, seq_iter_t *it);
+void seq_iter_rewind(seq_iter_t *it);
INLINE int seq_get(seq_iter_t *it, val *pval) { return it->get(it, pval); }
INLINE int seq_peek(seq_iter_t *it, val *pval) { return it->peek(it, pval); }
val seq_geti(seq_iter_t *it);
@@ -723,7 +723,7 @@ val numberp(val num);
val nary_op(val self, val (*bfun)(val, val),
val (*ufun)(val self, val),
struct args *args, val emptyval);
-val nary_simple_op(val self, val (*bfun)(val, val),
+val nary_simple_op(val (*bfun)(val, val),
struct args *args, val emptyval);
val plus(val anum, val bnum);
val plusv(struct args *);
diff --git a/struct.c b/struct.c
index 8446ba00..a00345fa 100644
--- a/struct.c
+++ b/struct.c
@@ -319,7 +319,7 @@ static cnum count_super_stslots(cnum nsupers, struct struct_type **sus,
return c;
}
-static val get_super_slots(cnum nsupers, struct struct_type **sus, val self)
+static val get_super_slots(cnum nsupers, struct struct_type **sus)
{
cnum i;
val slots = nil;
@@ -389,7 +389,7 @@ val make_struct_type(val name, val supers,
cnum nsupers = c_num(length(supers));
struct struct_type **sus = get_struct_handles(nsupers, supers, self);
val id = num_fast(coerce(ucnum, st) / (uptopow2(sizeof *st) / 2));
- val super_slots = get_super_slots(nsupers, sus, self);
+ val super_slots = get_super_slots(nsupers, sus);
val all_slots = uniq(append2(super_slots, append2(static_slots, slots)));
cnum stsl_upb = c_num(plus(length(static_slots),
num(count_super_stslots(nsupers, sus, self))));
diff --git a/sysif.c b/sysif.c
index 770ac330..0f614a2e 100644
--- a/sysif.c
+++ b/sysif.c
@@ -849,7 +849,7 @@ static void flock_pack(val self, val in, struct flock *out)
out->l_len = c_num(slot(in, len_s));
}
-static void flock_unpack(val self, val out, struct flock *in)
+static void flock_unpack(val out, struct flock *in)
{
slotset(out, type_s, num(in->l_type));
slotset(out, whence_s, num(in->l_whence));
@@ -893,7 +893,7 @@ static val fcntl_wrap(val fd_in, val cmd_in, val arg_in)
flock_pack(self, arg_in, &fl);
res = fcntl(fd, cmd, &fl);
if (cmd == F_GETLK)
- flock_unpack(self, arg_in, &fl);
+ flock_unpack(arg_in, &fl);
}
default:
errno = EINVAL;
diff --git a/unwind.c b/unwind.c
index f7f3dcec..54847c75 100644
--- a/unwind.c
+++ b/unwind.c
@@ -512,7 +512,7 @@ val uw_trace_error(val ctx, val exc, struct args *args)
}
void uw_push_cont_copy(uw_frame_t *fr, mem_t *ptr,
- void (*copy)(mem_t *ptr, int parent))
+ void (*copy)(mem_t *ptr))
{
memset(fr, 0, sizeof *fr);
fr->cp.type = UW_CONT_COPY;
@@ -1000,13 +1000,13 @@ static struct cobj_ops cont_ops = cobj_ops_init(eq,
cont_mark,
cobj_eq_hash_op);
-static void call_copy_handlers(uw_frame_t *upto, int parent)
+static void call_copy_handlers(uw_frame_t *upto)
{
uw_frame_t *fr;
for (fr = uw_stack; fr != 0 && fr != upto; fr = fr->uw.up) {
if (fr->uw.type == UW_CONT_COPY)
- fr->cp.copy(fr->cp.ptr, parent);
+ fr->cp.copy(fr->cp.ptr);
}
}
@@ -1076,7 +1076,7 @@ static val revive_cont(val dc, val arg)
bug_unless (uw_stack->uw.type == UW_BLOCK);
if (arg != sys_cont_poison_s)
- call_copy_handlers(&uw_blk, 0);
+ call_copy_handlers(&uw_blk);
uw_stack->bl.result = arg;
uw_exit_point = if3(arg == sys_cont_poison_s, &uw_blk, uw_stack);
@@ -1131,7 +1131,7 @@ static val capture_cont(val tag, val fun, uw_frame_t *block)
uw_block_end;
if (cont_obj) {
- call_copy_handlers(block, 0);
+ call_copy_handlers(block);
result = funcall1(fun, func_f1(cont_obj, revive_cont));
}
diff --git a/unwind.h b/unwind.h
index 7f195f47..768e71e1 100644
--- a/unwind.h
+++ b/unwind.h
@@ -258,7 +258,7 @@ struct uw_cont_copy {
uw_frame_t *up;
uw_frtype_t type;
mem_t *ptr;
- void (*copy)(mem_t *ptr, int parent);
+ void (*copy)(mem_t *ptr);
};
struct uw_guard {
@@ -361,7 +361,7 @@ val uw_muffle_warning(val exc, struct args *);
val uw_trace_error(val ctx, val exc, struct args *);
val uw_capture_cont(val tag, val fun, val ctx_form);
void uw_push_cont_copy(uw_frame_t *, mem_t *ptr,
- void (*copy)(mem_t *ptr, int parent));
+ void (*copy)(mem_t *ptr));
void uw_init(void);
void uw_late_init(void);