aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cparser/Cleanup.ml5
-rw-r--r--debug/Debug.ml3
-rw-r--r--debug/Debug.mli2
-rw-r--r--debug/DebugInformation.ml10
-rw-r--r--debug/DebugInit.ml1
5 files changed, 17 insertions, 4 deletions
diff --git a/cparser/Cleanup.ml b/cparser/Cleanup.ml
index c8a900d5..fe674d9b 100644
--- a/cparser/Cleanup.ml
+++ b/cparser/Cleanup.ml
@@ -186,7 +186,7 @@ let saturate p =
let remove_unused_debug = function
| Gdecl (_,id,_,_) -> Debug.remove_unused id
- | Gfundef f -> Debug.remove_unused f.fd_name
+ | Gfundef f -> Debug.remove_unused_function f.fd_name
| _ -> ()
let rec simpl_globdecls accu = function
@@ -212,6 +212,3 @@ let program p =
let p' = simpl_globdecls [] p in
referenced := IdentSet.empty;
p'
-
-
-
diff --git a/debug/Debug.ml b/debug/Debug.ml
index 789ecb70..775a0903 100644
--- a/debug/Debug.ml
+++ b/debug/Debug.ml
@@ -48,6 +48,7 @@ type implem =
compute_gnu_file_enum: (string -> unit) -> unit;
exists_section: section_name -> bool;
remove_unused: ident -> unit;
+ remove_unused_function: ident -> unit;
variable_printed: string -> unit;
add_diab_info: section_name -> int -> int -> int -> unit;
}
@@ -79,6 +80,7 @@ let default_implem =
compute_gnu_file_enum = (fun _ -> ());
exists_section = (fun _ -> true);
remove_unused = (fun _ -> ());
+ remove_unused_function = (fun _ -> ());
variable_printed = (fun _ -> ());
add_diab_info = (fun _ _ _ _ -> ());
}
@@ -110,5 +112,6 @@ let exists_section sec = !implem.exists_section sec
let compute_diab_file_enum end_l entry_l line_e = !implem.compute_diab_file_enum end_l entry_l line_e
let compute_gnu_file_enum f = !implem.compute_gnu_file_enum f
let remove_unused ident = !implem.remove_unused ident
+let remove_unused_function ident = !implem.remove_unused_function ident
let variable_printed ident = !implem.variable_printed ident
let add_diab_info sec line_start debug_info low_pc = !implem.add_diab_info sec line_start debug_info low_pc
diff --git a/debug/Debug.mli b/debug/Debug.mli
index 614fe84b..387491c2 100644
--- a/debug/Debug.mli
+++ b/debug/Debug.mli
@@ -46,6 +46,7 @@ type implem =
compute_gnu_file_enum: (string -> unit) -> unit;
exists_section: section_name -> bool;
remove_unused: ident -> unit;
+ remove_unused_function: ident -> unit;
variable_printed: string -> unit;
add_diab_info: section_name -> int -> int -> int -> unit;
}
@@ -79,5 +80,6 @@ val compute_diab_file_enum: (section_name -> int) -> (string-> int) -> (unit ->
val compute_gnu_file_enum: (string -> unit) -> unit
val exists_section: section_name -> bool
val remove_unused: ident -> unit
+val remove_unused_function: ident -> unit
val variable_printed: string -> unit
val add_diab_info: section_name -> int -> int -> int -> unit
diff --git a/debug/DebugInformation.ml b/debug/DebugInformation.ml
index ed00ea0d..be322a55 100644
--- a/debug/DebugInformation.ml
+++ b/debug/DebugInformation.ml
@@ -295,6 +295,16 @@ let gen_comp_typ sou id at =
let remove_unused id =
try
let id' = Hashtbl.find stamp_to_definition id.stamp in
+ let var = Hashtbl.find definitions id' in
+ match var with
+ | Function _ -> ()
+ | _ -> Hashtbl.remove definitions id';
+ Hashtbl.remove stamp_to_definition id.stamp
+ with Not_found -> ()
+
+let remove_unused_function id =
+ try
+ let id' = Hashtbl.find stamp_to_definition id.stamp in
Hashtbl.remove definitions id';
Hashtbl.remove stamp_to_definition id.stamp
with Not_found -> ()
diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml
index 455112ed..17a90536 100644
--- a/debug/DebugInit.ml
+++ b/debug/DebugInit.ml
@@ -45,6 +45,7 @@ let default_debug =
compute_gnu_file_enum = DebugInformation.compute_gnu_file_enum;
exists_section = DebugInformation.exists_section;
remove_unused = DebugInformation.remove_unused;
+ remove_unused_function = DebugInformation.remove_unused_function;
variable_printed = DebugInformation.variable_printed;
add_diab_info = (fun _ _ _ _ -> ());
}