Skip to content

Commit 92acc13

Browse files
committed
use the default set of warnings
1 parent 3be4c2f commit 92acc13

File tree

18 files changed

+152
-157
lines changed

18 files changed

+152
-157
lines changed

interpreter/binary/decode.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ let code_section s =
944944

945945
(* Element section *)
946946

947-
let passive s =
947+
let passive _s =
948948
Passive
949949

950950
let active s =
@@ -957,7 +957,7 @@ let active_zero s =
957957
let offset = const s in
958958
Active {index; offset}
959959

960-
let declarative s =
960+
let declarative _s =
961961
Declarative
962962

963963
let elem_index s =

interpreter/binary/utf8.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let con n = 0x80 lor (n land 0x3f)
88
let rec encode ns = Lib.String.implode (List.map Char.chr (encode' ns))
99
and encode' = function
1010
| [] -> []
11-
| n::ns when n < 0 ->
11+
| n::_ns when n < 0 ->
1212
raise Utf8
1313
| n::ns when n < 0x80 ->
1414
n :: encode' ns
@@ -32,7 +32,7 @@ and decode' = function
3232
| [] -> []
3333
| b1::bs when b1 < 0x80 ->
3434
code 0x0 b1 :: decode' bs
35-
| b1::bs when b1 < 0xc0 ->
35+
| b1::_bs when b1 < 0xc0 ->
3636
raise Utf8
3737
| b1::b2::bs when b1 < 0xe0 ->
3838
code 0x80 ((b1 land 0x1f) lsl 6 + con b2) :: decode' bs

interpreter/dune

-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
4646
(ocamlyacc
4747
(modules parser)))
4848

49-
(env
50-
(_
51-
(flags
52-
(-w +a-4-27-42-44-45-70 -warn-error +a-3))))
53-
5449
(rule
5550
(alias runtest)
5651
(deps

interpreter/exec/eval.ml

+27-27
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ let func_ref inst x i at =
102102
| _ -> Crash.error at ("type mismatch for element " ^ Int32.to_string i)
103103

104104
let func_type_of = function
105-
| Func.AstFunc (t, inst, f) -> t
105+
| Func.AstFunc (t, _inst, _f) -> t
106106
| Func.HostFunc (t, _) -> t
107107

108108
let block_type inst bt =
@@ -166,7 +166,7 @@ let rec step (c : config) : config =
166166
vs', [Label (n2, [], (args, List.map plain es')) @@ e.at]
167167

168168
| Loop (bt, es'), vs ->
169-
let FuncType (ts1, ts2) = block_type frame.inst bt in
169+
let FuncType (ts1, _ts2) = block_type frame.inst bt in
170170
let n1 = Lib.List32.length ts1 in
171171
let args, vs' = take n1 vs e.at, drop n1 vs e.at in
172172
vs', [Label (n1, [e' @@ e.at], (args, List.map plain es')) @@ e.at]
@@ -205,7 +205,7 @@ let rec step (c : config) : config =
205205
else
206206
vs, [Invoke func @@ e.at]
207207

208-
| Drop, v :: vs' ->
208+
| Drop, _v :: vs' ->
209209
vs', []
210210

211211
| Select _, Num (I32 i) :: v2 :: v1 :: vs' ->
@@ -362,7 +362,7 @@ let rec step (c : config) : config =
362362
vs', []
363363
with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at]);
364364

365-
| VecLoadLane ({offset; ty; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' ->
365+
| VecLoadLane ({offset; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' ->
366366
let mem = memory frame.inst (0l @@ e.at) in
367367
let addr = I64_convert.extend_i32_u i in
368368
(try
@@ -383,7 +383,7 @@ let rec step (c : config) : config =
383383
in Vec (V128 v) :: vs', []
384384
with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at])
385385

386-
| VecStoreLane ({offset; ty; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' ->
386+
| VecStoreLane ({offset; pack; _}, j), Vec (V128 v) :: Num (I32 i) :: vs' ->
387387
let mem = memory frame.inst (0l @@ e.at) in
388388
let addr = I64_convert.extend_i32_u i in
389389
(try
@@ -594,62 +594,62 @@ let rec step (c : config) : config =
594594
| Refer r, vs ->
595595
Ref r :: vs, []
596596

597-
| Trapping msg, vs ->
597+
| Trapping _msg, _vs ->
598598
assert false
599599

600-
| Returning vs', vs ->
600+
| Returning _vs', _vs ->
601601
Crash.error e.at "undefined frame"
602602

603-
| Breaking (k, vs'), vs ->
603+
| Breaking (_k, _vs'), _vs ->
604604
Crash.error e.at "undefined label"
605605

606-
| Label (n, es0, (vs', [])), vs ->
606+
| Label (_n, _es0, (vs', [])), vs ->
607607
vs' @ vs, []
608608

609-
| Label (n, es0, (vs', {it = Trapping msg; at} :: es')), vs ->
609+
| Label (_n, _es0, (_vs', {it = Trapping msg; at} :: _es')), vs ->
610610
vs, [Trapping msg @@ at]
611611

612-
| Label (n, es0, (vs', {it = Returning vs0; at} :: es')), vs ->
612+
| Label (_n, _es0, (_vs', {it = Returning vs0; at} :: _es')), vs ->
613613
vs, [Returning vs0 @@ at]
614614

615-
| Label (n, es0, (vs', {it = Breaking (0l, vs0); at} :: es')), vs ->
615+
| Label (n, es0, (_vs', {it = Breaking (0l, vs0); _ } :: _es')), vs ->
616616
take n vs0 e.at @ vs, List.map plain es0
617617

618-
| Label (n, es0, (vs', {it = Breaking (k, vs0); at} :: es')), vs ->
618+
| Label (_n, _es0, (_vs', {it = Breaking (k, vs0); at} :: _es')), vs ->
619619
vs, [Breaking (Int32.sub k 1l, vs0) @@ at]
620620

621621
| Label (n, es0, code'), vs ->
622622
let c' = step {c with code = code'} in
623623
vs, [Label (n, es0, c'.code) @@ e.at]
624624

625-
| Frame (n, frame', (vs', [])), vs ->
625+
| Frame (_n, _frame', (vs', [])), vs ->
626626
vs' @ vs, []
627627

628-
| Frame (n, frame', (vs', {it = Trapping msg; at} :: es')), vs ->
628+
| Frame (_n, _frame', (_vs', {it = Trapping msg; at} :: _es')), vs ->
629629
vs, [Trapping msg @@ at]
630630

631-
| Frame (n, frame', (vs', {it = Returning vs0; at} :: es')), vs ->
631+
| Frame (n, _frame', (_vs', {it = Returning vs0; _} :: _es')), vs ->
632632
take n vs0 e.at @ vs, []
633633

634634
| Frame (n, frame', code'), vs ->
635635
let c' = step {frame = frame'; code = code'; budget = c.budget - 1} in
636636
vs, [Frame (n, c'.frame, c'.code) @@ e.at]
637637

638-
| Invoke func, vs when c.budget = 0 ->
638+
| Invoke _func, _vs when c.budget = 0 ->
639639
Exhaustion.error e.at "call stack exhausted"
640640

641641
| Invoke func, vs ->
642642
let FuncType (ins, out) = func_type_of func in
643643
let n1, n2 = Lib.List32.length ins, Lib.List32.length out in
644644
let args, vs' = take n1 vs e.at, drop n1 vs e.at in
645645
(match func with
646-
| Func.AstFunc (t, inst', f) ->
646+
| Func.AstFunc (_t, inst', f) ->
647647
let locals' = List.rev args @ List.map default_value f.it.locals in
648648
let frame' = {inst = !inst'; locals = List.map ref locals'} in
649649
let instr' = [Label (n2, [], ([], List.map plain f.it.body)) @@ f.at] in
650650
vs', [Frame (n2, frame', ([], instr')) @@ e.at]
651651

652-
| Func.HostFunc (t, f) ->
652+
| Func.HostFunc (_t, f) ->
653653
try List.rev (f (List.rev args)) @ vs', []
654654
with Crash (_, msg) -> Crash.error e.at msg
655655
)
@@ -661,18 +661,18 @@ let rec eval (c : config) : value stack =
661661
| vs, [] ->
662662
vs
663663

664-
| vs, {it = Trapping msg; at} :: _ ->
664+
| _vs, {it = Trapping msg; at} :: _ ->
665665
Trap.error at msg
666666

667-
| vs, es ->
667+
| _vs, _es ->
668668
eval (step c)
669669

670670

671671
(* Functions & Constants *)
672672

673673
let invoke (func : func_inst) (vs : value list) : value list =
674674
let at = match func with Func.AstFunc (_, _, f) -> f.at | _ -> no_region in
675-
let FuncType (ins, out) = Func.type_of func in
675+
let FuncType (ins, _out) = Func.type_of func in
676676
if List.length vs <> List.length ins then
677677
Crash.error at "wrong number of arguments";
678678
if not (List.for_all2 (fun v -> (=) (type_of_value v)) vs ins) then
@@ -685,20 +685,20 @@ let eval_const (inst : module_inst) (const : const) : value =
685685
let c = config inst [] (List.map plain const.it) in
686686
match eval c with
687687
| [v] -> v
688-
| vs -> Crash.error const.at "wrong number of results on stack"
688+
| _vs -> Crash.error const.at "wrong number of results on stack"
689689

690690

691691
(* Modules *)
692692

693693
let create_func (inst : module_inst) (f : func) : func_inst =
694694
Func.alloc (type_ inst f.it.ftype) (ref inst) f
695695

696-
let create_table (inst : module_inst) (tab : table) : table_inst =
696+
let create_table (_inst : module_inst) (tab : table) : table_inst =
697697
let {ttype} = tab.it in
698698
let TableType (_lim, t) = ttype in
699699
Table.alloc ttype (NullRef t)
700700

701-
let create_memory (inst : module_inst) (mem : memory) : memory_inst =
701+
let create_memory (_inst : module_inst) (mem : memory) : memory_inst =
702702
let {mtype} = mem.it in
703703
Memory.alloc mtype
704704

@@ -718,10 +718,10 @@ let create_export (inst : module_inst) (ex : export) : export_inst =
718718
in (name, ext)
719719

720720
let create_elem (inst : module_inst) (seg : elem_segment) : elem_inst =
721-
let {etype; einit; _} = seg.it in
721+
let { einit; _} = seg.it in
722722
Elem.alloc (List.map (fun c -> as_ref (eval_const inst c)) einit)
723723

724-
let create_data (inst : module_inst) (seg : data_segment) : data_inst =
724+
let create_data (_inst : module_inst) (seg : data_segment) : data_inst =
725725
let {dinit; _} = seg.it in
726726
Data.alloc dinit
727727

interpreter/exec/eval_num.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct
8989
| CopySign -> FXX.copysign
9090
in fun v1 v2 -> to_num (f (of_num 1 v1) (of_num 2 v2))
9191

92-
let testop op = assert false
92+
let testop _op = assert false
9393

9494
let relop op =
9595
let f = match op with

interpreter/exec/ixx.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct
175175

176176
(* result is floored (which is the same as truncating for unsigned values) *)
177177
let div_u x y =
178-
let q, r = divrem_u x y in q
178+
let q, _r = divrem_u x y in q
179179

180180
(* result has the sign of the dividend *)
181181
let rem_s x y =
@@ -185,7 +185,7 @@ struct
185185
Rep.rem x y
186186

187187
let rem_u x y =
188-
let q, r = divrem_u x y in r
188+
let _q, r = divrem_u x y in r
189189

190190
let avgr_u x y =
191191
let open Int64 in

interpreter/exec/v128.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct
109109
let reduceop f a s = List.fold_left (fun a b -> f a (b <> IXX.zero)) a (to_lanes s)
110110
let cmp f x y = if f x y then IXX.of_int_s (-1) else IXX.zero
111111

112-
let splat x = of_lanes (List.init num_lanes (fun i -> x))
112+
let splat x = of_lanes (List.init num_lanes (fun _i -> x))
113113
let extract_lane_s i s = List.nth (to_lanes s) i
114114
let extract_lane_u i s = IXX.as_unsigned (extract_lane_s i s)
115115
let replace_lane i v x = unopi (fun j y -> if j = i then x else y) v
@@ -212,7 +212,7 @@ struct
212212
let all_ones = FXX.of_float (Int64.float_of_bits (Int64.minus_one))
213213
let cmp f x y = if f x y then all_ones else FXX.zero
214214

215-
let splat x = of_lanes (List.init num_lanes (fun i -> x))
215+
let splat x = of_lanes (List.init num_lanes (fun _i -> x))
216216
let extract_lane i s = List.nth (to_lanes s) i
217217
let replace_lane i v x = unopi (fun j y -> if j = i then x else y) v
218218

interpreter/host/env.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ let type_error v t =
1818

1919
let empty = function
2020
| [] -> ()
21-
| vs -> error "type error, too many arguments"
21+
| _vs -> error "type error, too many arguments"
2222

2323
let single = function
2424
| [] -> error "type error, missing arguments"
2525
| [v] -> v
26-
| vs -> error "type error, too many arguments"
26+
| _vs -> error "type error, too many arguments"
2727

2828
let int = function
2929
| Num (I32 i) -> Int32.to_int i

interpreter/runtime/table.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ let load tab i =
5151
Lib.Array32.get tab.content i
5252

5353
let store tab i r =
54-
let TableType (lim, t) = tab.ty in
54+
let TableType (_lim, t) = tab.ty in
5555
if type_of_ref r <> t then raise Type;
5656
if i < 0l || i >= Lib.Array32.length tab.content then raise Bounds;
5757
Lib.Array32.set tab.content i r

interpreter/script/import.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let registry = ref Registry.empty
1010
let register name lookup = registry := Registry.add name lookup !registry
1111

1212
let lookup (m : module_) (im : import) : Instance.extern =
13-
let {module_name; item_name; idesc} = im.it in
13+
let {module_name; item_name; _} = im.it in
1414
let t = import_type m im in
1515
try Registry.find module_name !registry item_name t with Not_found ->
1616
Unknown.error im.at

interpreter/script/js.ml

+7-7
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ let bind (mods : modules) x_opt m =
217217
let lookup (mods : modules) x_opt name at =
218218
let exports =
219219
try Map.find (of_var_opt mods x_opt) mods.env with Not_found ->
220-
raise (Eval.Crash (at,
220+
raise (Eval.Crash (at,
221221
if x_opt = None then "no module defined within script"
222222
else "unknown module " ^ of_var_opt mods x_opt ^ " within script"))
223223
in try NameMap.find name exports with Not_found ->
@@ -275,10 +275,10 @@ let invoke ft vs at =
275275
let get t at =
276276
[], GlobalImport t @@ at, [GlobalGet (subject_idx @@ at) @@ at]
277277

278-
let run ts at =
278+
let run _ts _at =
279279
[], []
280280

281-
let assert_return ress ts at =
281+
let assert_return ress _ts at =
282282
let test res =
283283
let nan_bitmask_of = function
284284
| CanonicalNan -> abs_mask_of (* must only differ from the canonical NaN in its sign bit *)
@@ -354,7 +354,7 @@ let assert_return ress ts at =
354354
VecTest (V128 (V128.I8x16 V128Op.AllTrue)) @@ at;
355355
Test (I32 I32Op.Eqz) @@ at;
356356
BrIf (0l @@ at) @@ at ]
357-
| RefResult (RefPat {it = Values.NullRef t; _}) ->
357+
| RefResult (RefPat {it = Values.NullRef _t; _}) ->
358358
[ RefIsNull @@ at;
359359
Test (Values.I32 I32Op.Eqz) @@ at;
360360
BrIf (0l @@ at) @@ at ]
@@ -425,8 +425,8 @@ let is_js_num_type = function
425425

426426
let is_js_value_type = function
427427
| NumType t -> is_js_num_type t
428-
| VecType t -> false
429-
| RefType t -> true
428+
| VecType _t -> false
429+
| RefType _t -> true
430430

431431
let is_js_global_type = function
432432
| GlobalType (t, mut) -> is_js_value_type t && mut = Immutable
@@ -508,7 +508,7 @@ let of_num_pat = function
508508
| Values.F32 n | Values.F64 n -> of_nan n
509509

510510
let of_vec_pat = function
511-
| VecPat (Values.V128 (shape, pats)) ->
511+
| VecPat (Values.V128 (_shape, pats)) ->
512512
Printf.sprintf "v128(\"%s\")" (String.concat " " (List.map of_num_pat pats))
513513

514514
let of_ref_pat = function

interpreter/script/run.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ let input_binary_file file run =
155155
success
156156
with exn -> close_in ic; raise exn
157157

158-
let input_js_file file run =
158+
let input_js_file file _run =
159159
raise (Sys_error (file ^ ": unrecognized input file type"))
160160

161161
let input_file file run =
@@ -268,7 +268,7 @@ let string_of_num_pat (p : num_pat) =
268268

269269
let string_of_vec_pat (p : vec_pat) =
270270
match p with
271-
| VecPat (Values.V128 (shape, ns)) ->
271+
| VecPat (Values.V128 (_shape, ns)) ->
272272
String.concat " " (List.map string_of_num_pat ns)
273273

274274
let string_of_ref_pat (p : ref_pat) =
@@ -347,7 +347,7 @@ let run_action act : Values.value list =
347347
let inst = lookup_instance x_opt act.at in
348348
(match Instance.export inst name with
349349
| Some (Instance.ExternFunc f) ->
350-
let Types.FuncType (ins, out) = Func.type_of f in
350+
let Types.FuncType (ins, _out) = Func.type_of f in
351351
if List.length vs <> List.length ins then
352352
Script.error act.at "wrong number of arguments";
353353
List.iter2 (fun v t ->

0 commit comments

Comments
 (0)