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. --- debug/Debug.ml | 5 ++--- debug/Debug.mli | 2 +- debug/DebugInformation.ml | 8 ++++---- debug/DebugInit.ml | 6 ------ debug/DwarfPrinter.ml | 11 +++-------- debug/DwarfTypes.mli | 3 +-- debug/Dwarfgen.ml | 2 +- 7 files changed, 12 insertions(+), 25 deletions(-) (limited to 'debug') diff --git a/debug/Debug.ml b/debug/Debug.ml index 775a0903..7403d7c2 100644 --- a/debug/Debug.ml +++ b/debug/Debug.ml @@ -12,9 +12,8 @@ open AST open BinNums -open C +open !C open Camlcoq -open Dwarfgen open DwarfTypes open Sections @@ -32,7 +31,7 @@ type implem = add_fun_addr: atom -> section_name -> (int * int) -> unit; generate_debug_info: (atom -> string) -> string -> debug_entries option; all_files_iter: (string -> unit) -> unit; - insert_local_declaration: storage -> ident -> typ -> location -> unit; + insert_local_declaration: storage -> ident -> C.typ -> location -> unit; atom_local_variable: ident -> atom -> unit; enter_scope: int -> int -> int -> unit; enter_function_scope: int -> int -> unit; diff --git a/debug/Debug.mli b/debug/Debug.mli index 387491c2..f044b1ad 100644 --- a/debug/Debug.mli +++ b/debug/Debug.mli @@ -11,7 +11,7 @@ (* *********************************************************************) open AST -open C +open !C open Camlcoq open DwarfTypes open BinNums diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml index 105b6aad..e8f1703a 100644 --- a/debug/DebugInformation.ml +++ b/debug/DebugInformation.ml @@ -51,7 +51,7 @@ let types: (int,debug_types) Hashtbl.t = Hashtbl.create 7 let lookup_types: (string, int) Hashtbl.t = Hashtbl.create 7 (* Translate a C.typ to a string needed for hashing *) -let typ_to_string (ty: typ) = +let typ_to_string ty = let buf = Buffer.create 7 in let chan = Format.formatter_of_buffer buf in Cprint.print_debug_idents := true; @@ -64,13 +64,13 @@ let typ_to_string (ty: typ) = let strip_attributes typ = strip_attributes_type typ [AConst; AVolatile] (* Find the type id to an type *) -let find_type (ty: typ) = +let find_type ty = (* We are only interested in Const and Volatile *) let ty = strip_attributes ty in Hashtbl.find lookup_types (typ_to_string ty) (* Add type and information *) -let insert_type (ty: typ) = +let insert_type ty = let insert d_ty ty = let id = next_id () and name = typ_to_string ty in @@ -104,7 +104,7 @@ let insert_type (ty: typ) = arr_size= s; } in ArrayType arr - | TFun (t,param,va,_) -> + | TFun (t,param,_,_) -> let param,prot = (match param with | None -> [],false | Some p -> List.map (fun (i,t) -> let t = attr_aux t in diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml index 17a90536..24712b27 100644 --- a/debug/DebugInit.ml +++ b/debug/DebugInit.ml @@ -10,12 +10,6 @@ (* *) (* *********************************************************************) -open AST -open BinNums -open C -open Camlcoq -open Dwarfgen -open DwarfTypes open Debug let default_debug = diff --git a/debug/DwarfPrinter.ml b/debug/DwarfPrinter.ml index ef44a2d5..9313b6c5 100644 --- a/debug/DwarfPrinter.ml +++ b/debug/DwarfPrinter.ml @@ -33,9 +33,6 @@ module DwarfPrinter(Target: DWARF_TARGET): let string_of_comment s = sprintf " %s %s" comment s - let add_comment buf s = - Buffer.add_string buf (sprintf " %s %s" comment s) - (* Byte value to string *) let string_of_byte value ct = sprintf " .byte %s%s\n" (if value then "0x1" else "0x0") (string_of_comment ct) @@ -67,8 +64,6 @@ module DwarfPrinter(Target: DWARF_TARGET): let add_member_size = add_abbr_entry (0x0b,"DW_AT_byte_size",DW_FORM_udata) - let add_high_pc = add_abbr_entry (0x12,"DW_AT_high_pc",DW_FORM_addr) - let add_low_pc = add_abbr_entry (0x11,"DW_AT_low_pc",DW_FORM_addr) let add_declaration = add_abbr_entry (0x3c,"DW_AT_declaration",DW_FORM_flag) @@ -115,7 +110,7 @@ module DwarfPrinter(Target: DWARF_TARGET): if has_sibling then add_abbr_entry (0x1,"DW_AT_sibling",DW_FORM_ref4) buf; in (match entity.tag with - | DW_TAG_array_type e -> + | DW_TAG_array_type _ -> prologue 0x1 "DW_TAG_array_type"; add_type buf | DW_TAG_base_type b -> @@ -623,9 +618,9 @@ module DwarfPrinter(Target: DWARF_TARGET): let name = if e.section_name <> ".text" then Some e.section_name else None in section oc (Section_debug_info name); print_debug_info oc e.start_label e.line_label e.entry) entries; - if List.exists (fun e -> match e.locs with _,[] -> false | _,_ -> true) entries then begin + if List.exists (fun e -> match e.dlocs with _,[] -> false | _,_ -> true) entries then begin section oc Section_debug_loc; - List.iter (fun e -> print_location_list oc e.locs) entries + List.iter (fun e -> print_location_list oc e.dlocs) entries end let print_ranges oc r = diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index 2af64c0b..f6074cf3 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -12,7 +12,6 @@ (* Types used for writing dwarf debug information *) -open BinNums open Camlcoq open Sections @@ -285,7 +284,7 @@ type diab_entry = start_label: int; line_label: int; entry: dw_entry; - locs: dw_locations; + dlocs: dw_locations; } type diab_entries = diab_entry list diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index d070e3a9..fe0764e8 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -534,7 +534,7 @@ let diab_gen_compilation_section s defs acc = start_label = debug_start; line_label = line_start; entry = cp; - locs = Some low_pc,accu.locs; + dlocs = Some low_pc,accu.locs; }::acc let gen_diab_debug_info sec_name var_section : debug_entries = -- cgit