summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2013-02-24 09:11:29 +0000
committerGabriel Scherer <gabriel.scherer@gmail.com>2013-02-24 09:11:29 +0000
commitbca20db06008747cc4f928ed1f452a18bfea47c2 (patch)
tree34ca22a063fa8c09bcce819879c01fd4a2b44fb0
parent23994ac6dea98805f9077b9b7fc74cfa13a80a7f (diff)
downloadocaml-bca20db06008747cc4f928ed1f452a18bfea47c2.tar.gz
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--Changes1
-rw-r--r--tools/ocamldep.ml13
2 files changed, 11 insertions, 3 deletions
diff --git a/Changes b/Changes
index cf1d68f3d4..06470ecfcf 100644
--- a/Changes
+++ b/Changes
@@ -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 1bafbc6780..1b958db233 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