aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorletouzey2013-03-12 23:59:52 +0000
committerletouzey2013-03-12 23:59:52 +0000
commit027618d5aa99613ffbe390371cda492690809cc7 (patch)
tree173636aff2f8e73d3b3da93362c0b94945650100
parentd5c15e8836c2225fceaf7f2abc564b04dec653ee (diff)
Restrict (try...with...) to avoid catching critical exn (part 4)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16280 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--lib/envars.ml18
-rw-r--r--lib/store.ml2
2 files changed, 9 insertions, 11 deletions
diff --git a/lib/envars.ml b/lib/envars.ml
index 47ecdb4005..84a41f8e44 100644
--- a/lib/envars.ml
+++ b/lib/envars.ml
@@ -154,7 +154,7 @@ let guess_camlbin () = which (user_path ()) (exe "ocamlc")
let camlbin () =
if !Flags.camlbin_spec then !Flags.camlbin else
if !Flags.boot then Coq_config.camlbin else
- try guess_camlbin () with _ -> Coq_config.camlbin
+ try guess_camlbin () with Not_found -> Coq_config.camlbin
let ocamlc () = camlbin () / Coq_config.ocamlc
@@ -175,15 +175,13 @@ let guess_camlp4bin () = which (user_path ()) (exe Coq_config.camlp4)
let camlp4bin () =
if !Flags.camlp4bin_spec then !Flags.camlp4bin else
if !Flags.boot then Coq_config.camlp4bin else
- try
- guess_camlp4bin ()
- with _ ->
- if Sys.file_exists (camlbin () / exe Coq_config.camlp4) then
- camlbin ()
- else
- Coq_config.camlp4bin
-
-let camlp4 () = camlp4bin () / Coq_config.camlp4
+ try guess_camlp4bin ()
+ with Not_found ->
+ let cb = camlbin () in
+ if Sys.file_exists (cb / exe Coq_config.camlp4) then cb
+ else Coq_config.camlp4bin
+
+let camlp4 () = camlp4bin () / exe Coq_config.camlp4
let camlp4lib () =
if !Flags.boot then
diff --git a/lib/store.ml b/lib/store.ml
index 4d6a74ec12..1cfea2525a 100644
--- a/lib/store.ml
+++ b/lib/store.ml
@@ -50,7 +50,7 @@ let set s (id : 'a field) (x : 'a) = Int.Map.add id (Obj.repr x) s
let get s (id : 'a field) : 'a option =
try Some (Obj.obj (Int.Map.find id s))
- with _ -> None
+ with Not_found -> None
let remove s (id : 'a field) =
Int.Map.remove id s