diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2013-02-24 09:11:29 +0000 |
---|---|---|
committer | Gabriel Scherer <gabriel.scherer@gmail.com> | 2013-02-24 09:11:29 +0000 |
commit | bca20db06008747cc4f928ed1f452a18bfea47c2 (patch) | |
tree | 34ca22a063fa8c09bcce819879c01fd4a2b44fb0 | |
parent | 23994ac6dea98805f9077b9b7fc74cfa13a80a7f (diff) |
fix PR#5930: ocamldep leaks temporary preprocessing files
Ah, if we had let-try...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13309 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | tools/ocamldep.ml | 13 |
2 files changed, 11 insertions, 3 deletions
@@ -109,6 +109,7 @@ Bug fixes: - PR#5906: GADT exhaustiveness check is still broken - PR#5907: Undetected cycle during typecheck causes exceptions - PR#5911: Signature substitutions fail in submodules +- PR#5930: ocamldep leaks temporary preprocessing files OCaml 4.00.1: ------------- diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml index 1bafbc678..1b958db23 100644 --- a/tools/ocamldep.ml +++ b/tools/ocamldep.ml @@ -207,9 +207,16 @@ let read_parse_and_extract parse_function extract_function magic source_file = Depend.free_structure_names := Depend.StringSet.empty; try let input_file = Pparse.preprocess source_file in - let ast = Pparse.file Format.err_formatter input_file parse_function magic in - extract_function Depend.StringSet.empty ast; - !Depend.free_structure_names + begin try + let ast = + Pparse.file Format.err_formatter input_file parse_function magic in + extract_function Depend.StringSet.empty ast; + Pparse.remove_preprocessed input_file; + !Depend.free_structure_names + with x -> + Pparse.remove_preprocessed_if_ast input_file; + raise x + end with x -> report_err source_file x; Depend.StringSet.empty |