PR#5787: Bad behavior of 'Unused ...' warnings in the toplevel.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13010 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2012-10-12 08:24:34 +00:00
parent e196c83bf3
commit 08c3b1780a
4 changed files with 18 additions and 7 deletions

View File

@ -26,6 +26,7 @@ Bug fixes:
- PR#5747: 'unused open' warning not given when compiling with -annot
- PR#5758: Compiler bug when matching on floats
- PR#5763: ocamlbuild does not give correct flags when running menhir
- PR#5787: Bad behavior of 'Unused ...' warnings in the toplevel
Internals:
- Moved debugger/envaux.ml to typing/envaux.ml to publish env_of_only_summary

View File

@ -422,7 +422,7 @@ let loop ppf =
first_line := true;
let phr = try !parse_toplevel_phrase lb with Exit -> raise PPerror in
if !Clflags.dump_parsetree then Printast.top_phrase ppf phr;
Env.reset_missing_cmis ();
Env.reset_cache_toplevel ();
ignore(execute_phrase true ppf phr)
with
| End_of_file -> exit 0

View File

@ -329,13 +329,21 @@ let reset_cache () =
Hashtbl.clear persistent_structures;
Consistbl.clear crc_units;
Hashtbl.clear value_declarations;
Hashtbl.clear type_declarations
Hashtbl.clear type_declarations;
Hashtbl.clear used_constructors
let reset_missing_cmis () =
let l = Hashtbl.fold
let reset_cache_toplevel () =
(* Delete 'missing cmi' entries from the cache. *)
let l =
Hashtbl.fold
(fun name r acc -> if r = None then name :: acc else acc)
persistent_structures [] in
List.iter (Hashtbl.remove persistent_structures) l
persistent_structures []
in
List.iter (Hashtbl.remove persistent_structures) l;
Hashtbl.clear value_declarations;
Hashtbl.clear type_declarations;
Hashtbl.clear used_constructors
let set_unit_name name =
current_unit := name

View File

@ -108,7 +108,9 @@ val enter_cltype: string -> class_type_declaration -> t -> Ident.t * t
(* Initialize the cache of in-core module interfaces. *)
val reset_cache: unit -> unit
val reset_missing_cmis: unit -> unit
(* To be called before each toplevel phrase. *)
val reset_cache_toplevel: unit -> unit
(* Remember the name of the current compilation unit. *)
val set_unit_name: string -> unit