diff options
author | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2013-03-13 00:00:17 +0000 |
---|---|---|
committer | letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2013-03-13 00:00:17 +0000 |
commit | 9aecb4427f0f8ca3cb4c26bc7f73bb74164a93d9 (patch) | |
tree | 36a4ab30f4a75e73c9f4921cca1d25d1cb7cd545 /kernel | |
parent | 552df1605233769ad3cdabaadaa0011605e79797 (diff) |
Restrict (try...with...) to avoid catching critical exn (part 8)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16284 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/csymtable.ml | 6 | ||||
-rw-r--r-- | kernel/nativecode.ml | 4 | ||||
-rw-r--r-- | kernel/nativelib.ml | 2 | ||||
-rw-r--r-- | kernel/pre_env.ml | 2 | ||||
-rw-r--r-- | kernel/safe_typing.ml | 3 |
5 files changed, 9 insertions, 8 deletions
diff --git a/kernel/csymtable.ml b/kernel/csymtable.ml index bef5b751f..5dd4cb570 100644 --- a/kernel/csymtable.ml +++ b/kernel/csymtable.ml @@ -160,11 +160,11 @@ and eval_to_patch env (buff,pl,fv) = and val_of_constr env c = let (_,fun_code,_ as ccfv) = try compile env c - with e -> - let e = Errors.push e in + with reraise -> + let reraise = Errors.push reraise in let () = print_string "can not compile \n" in let () = Format.print_flush () in - raise e + raise reraise in eval_to_patch env (to_memory ccfv) diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml index aeb5412e4..34f26086a 100644 --- a/kernel/nativecode.ml +++ b/kernel/nativecode.ml @@ -782,7 +782,7 @@ let subst s l = else let rec aux l = match l with - | MLlocal id -> (try LNmap.find id s with _ -> l) + | MLlocal id -> (try LNmap.find id s with Not_found -> l) | MLglobal _ | MLprimitive _ | MLint _ -> l | MLlam(params,body) -> MLlam(params, aux body) | MLletrec(defs,body) -> @@ -851,7 +851,7 @@ let commutative_cut annot a accu bs args = let optimize gdef l = let rec optimize s l = match l with - | MLlocal id -> (try LNmap.find id s with _ -> l) + | MLlocal id -> (try LNmap.find id s with Not_found -> l) | MLglobal _ | MLprimitive _ | MLint _ -> l | MLlam(params,body) -> MLlam(params, optimize s body) diff --git a/kernel/nativelib.ml b/kernel/nativelib.ml index 46125a2c7..6b2b4aa7c 100644 --- a/kernel/nativelib.ml +++ b/kernel/nativelib.ml @@ -91,7 +91,7 @@ let call_linker ~fatal prefix f upds = with | Dynlink.Error e -> let msg = "Dynlink error, " ^ Dynlink.error_message e in if fatal then anomaly (Pp.str msg) else Pp.msg_warning (Pp.str msg) - | _ -> + | e when Errors.noncritical e -> let msg = "Dynlink error" in if fatal then anomaly (Pp.str msg) else Pp.msg_warning (Pp.str msg)); match upds with Some upds -> update_locations upds | _ -> () diff --git a/kernel/pre_env.ml b/kernel/pre_env.ml index 2a467ad0a..f365d19c3 100644 --- a/kernel/pre_env.ml +++ b/kernel/pre_env.ml @@ -90,7 +90,7 @@ let push_rel d env = let lookup_rel_val n env = try List.nth env.env_rel_val (n - 1) - with _ -> raise Not_found + with Failure _ -> raise Not_found let env_of_rel n env = { env with diff --git a/kernel/safe_typing.ml b/kernel/safe_typing.ml index fa565fa34..b2d08e977 100644 --- a/kernel/safe_typing.ml +++ b/kernel/safe_typing.ml @@ -881,7 +881,8 @@ end = struct let k = key_of_lazy_constr k in let access key = try (Lazy.force table).(key) - with _ -> error "Error while retrieving an opaque body" + with e when Errors.noncritical e -> + error "Error while retrieving an opaque body" in match load_proof with | Flags.Force -> |