From 5b05d3668571bd9b748b781b0cc29ae10f745f61 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 10 Mar 2016 13:35:48 +0100 Subject: Code cleanup. Removed some unused variables, functions etc. and resolved some problems which occur if all warnings except 3,4,9 and 29 are active. Bug 18394. --- cparser/Unblock.ml | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'cparser/Unblock.ml') diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml index ef8bc91c..eaf49164 100644 --- a/cparser/Unblock.ml +++ b/cparser/Unblock.ml @@ -46,13 +46,13 @@ let rec local_initializer env path init k = (array_init (Int64.succ pos) il') end in array_init 0L il - | Init_struct(id, fil) -> + | Init_struct(_, fil) -> let field_init (fld, i) k = local_initializer env { edesc = EUnop(Odot fld.fld_name, path); etyp = fld.fld_typ } i k in List.fold_right field_init fil k - | Init_union(id, fld, i) -> + | Init_union(_, fld, i) -> local_initializer env { edesc = EUnop(Odot fld.fld_name, path); etyp = fld.fld_typ } i k @@ -64,17 +64,6 @@ let add_inits_stmt loc inits s = (fun e s -> sseq loc {sdesc = Sdo e; sloc = loc} s) inits s -(* Prepend assignments to the given expression. *) -(* Associate to the left so that it prints more nicely *) - -let add_inits_expr inits e = - match inits with - | [] -> e - | i1 :: il -> - let comma a b = - { edesc = EBinop(Ocomma, a, b, b.etyp); etyp = b.etyp } in - comma (List.fold_left comma i1 il) e - (* Record new variables to be locally or globally defined *) let local_variables = ref ([]: decl list) @@ -304,7 +293,7 @@ let rec unblock_stmt env ctx ploc s = | Slabeled(lbl, s1) -> add_lineno ctx ploc s.sloc {s with sdesc = Slabeled(lbl, unblock_stmt env ctx s.sloc s1)} - | Sgoto lbl -> + | Sgoto _ -> add_lineno ctx ploc s.sloc s | Sreturn None -> add_lineno ctx ploc s.sloc s @@ -322,7 +311,7 @@ let rec unblock_stmt env ctx ploc s = id:: ctx else ctx in unblock_block env ctx' ploc sl - | Sdecl d -> + | Sdecl _ -> assert false | Sasm(attr, template, outputs, inputs, clob) -> let expand_asm_operand (lbl, cstr, e) = @@ -357,7 +346,7 @@ let unblock_fundef env f = (* Simplification of compound literals within a top-level declaration *) -let unblock_decl loc env ((sto, id, ty, optinit) as d) = +let unblock_decl env ((sto, id, ty, optinit) as d) = match optinit with | None -> [d] | Some init -> @@ -375,8 +364,8 @@ let rec unblock_glob env accu = function | [] -> List.rev accu | g :: gl -> match g.gdesc with - | Gdecl((sto, id, ty, init) as d) -> - let dl = unblock_decl g.gloc env d in + | Gdecl d -> + let dl = unblock_decl env d in unblock_glob env (List.rev_append (List.map (fun d' -> {g with gdesc = Gdecl d'}) dl) @@ -387,7 +376,7 @@ let rec unblock_glob env accu = function unblock_glob env ({g with gdesc = Gfundef f'} :: accu) gl | Gcompositedecl(su, id, attr) -> unblock_glob - (Env.add_composite env id (composite_info_decl env su attr)) + (Env.add_composite env id (composite_info_decl su attr)) (g :: accu) gl | Gcompositedef(su, id, attr, fl) -> unblock_glob -- cgit