aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-03-12 23:59:05 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-03-12 23:59:05 +0000
commit3b7ecfa6d4da684a635b2469c2d9a2e1e0ed0807 (patch)
tree2ce23cad6a0067480658001f0636efbdd3269b51 /kernel
parentb66d099bdda2ce1cfaeeb7938346a348ef4d40cd (diff)
invalid_arg instead of raise (Invalid_argement ...)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16270 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cbytegen.ml4
-rw-r--r--kernel/cemitcodes.ml7
-rw-r--r--kernel/nativecode.ml6
-rw-r--r--kernel/nativelambda.ml21
-rw-r--r--kernel/vm.ml6
5 files changed, 20 insertions, 24 deletions
diff --git a/kernel/cbytegen.ml b/kernel/cbytegen.ml
index 0f3636632..af6992252 100644
--- a/kernel/cbytegen.ml
+++ b/kernel/cbytegen.ml
@@ -497,8 +497,8 @@ let rec get_allias env kn =
let rec compile_constr reloc c sz cont =
match kind_of_term c with
- | Meta _ -> raise (Invalid_argument "Cbytegen.compile_constr : Meta")
- | Evar _ -> raise (Invalid_argument "Cbytegen.compile_constr : Evar")
+ | Meta _ -> invalid_arg "Cbytegen.compile_constr : Meta"
+ | Evar _ -> invalid_arg "Cbytegen.compile_constr : Evar"
| Cast(c,_,_) -> compile_constr reloc c sz cont
diff --git a/kernel/cemitcodes.ml b/kernel/cemitcodes.ml
index 90b4f0ae0..532f57866 100644
--- a/kernel/cemitcodes.ml
+++ b/kernel/cemitcodes.ml
@@ -61,8 +61,7 @@ let out_word b1 b2 b3 b4 =
then 2 * len
else
if len = Sys.max_string_length
- then raise (Invalid_argument "String.create") (* Pas la bonne execption
-.... *)
+ then invalid_arg "String.create" (* Pas la bonne exception .... *)
else Sys.max_string_length in
let new_buffer = String.create new_len in
String.blit !out_buffer 0 new_buffer 0 len;
@@ -214,7 +213,7 @@ let emit_instr = function
| Kconst c ->
out opGETGLOBAL; slot_for_const c
| Kmakeblock(n, t) ->
- if Int.equal n 0 then raise (Invalid_argument "emit_instr : block size = 0")
+ if Int.equal n 0 then invalid_arg "emit_instr : block size = 0"
else if n < 4 then (out(opMAKEBLOCK1 + n - 1); out_int t)
else (out opMAKEBLOCK; out_int n; out_int t)
| Kmakeprod ->
@@ -237,7 +236,7 @@ let emit_instr = function
| Ksetfield n ->
if n <= 1 then out (opSETFIELD0+n)
else (out opSETFIELD;out_int n)
- | Ksequence _ -> raise (Invalid_argument "Cemitcodes.emit_instr")
+ | Ksequence _ -> invalid_arg "Cemitcodes.emit_instr"
(* spiwack *)
| Kbranch lbl -> out opBRANCH; out_label lbl
| Kaddint31 -> out opADDINT31
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index 5bdb339d2..aeb5412e4 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -399,7 +399,7 @@ let get_prod_name codom =
let get_lname (_,l) =
match l with
| MLlocal id -> id
- | _ -> raise (Invalid_argument "Nativecode.get_lname")
+ | _ -> invalid_arg "Nativecode.get_lname"
let fv_params env =
let fvn, fvr = !(env.env_named), !(env.env_urel) in
@@ -1401,8 +1401,8 @@ let compile_mind_deps env prefix ~interactive
reverse order, as well as linking information updates *)
let rec compile_deps env prefix ~interactive init t =
match kind_of_term t with
- | Meta _ -> raise (Invalid_argument "Nativecode.get_deps: Meta")
- | Evar _ -> raise (Invalid_argument "Nativecode.get_deps: Evar")
+ | Meta _ -> invalid_arg "Nativecode.get_deps: Meta"
+ | Evar _ -> invalid_arg "Nativecode.get_deps: Evar"
| Ind (mind,_) -> compile_mind_deps env prefix ~interactive init mind
| Const c ->
let c = get_allias env c in
diff --git a/kernel/nativelambda.ml b/kernel/nativelambda.ml
index b8580f2b3..154345ca2 100644
--- a/kernel/nativelambda.ml
+++ b/kernel/nativelambda.ml
@@ -437,7 +437,7 @@ module Vect =
let extend v =
if Int.equal v.size (Array.length v.elems) then
let new_size = min (2*v.size) Sys.max_array_length in
- if new_size <= v.size then raise (Invalid_argument "Vect.extend");
+ if new_size <= v.size then invalid_arg "Vect.extend";
let new_elems = Array.make new_size v.elems.(0) in
Array.blit v.elems 0 new_elems 0 (v.size);
v.elems <- new_elems
@@ -458,19 +458,16 @@ module Vect =
let pop v = popn v 1
let get v n =
- if v.size <= n then raise
- (Invalid_argument "Vect.get:index out of bounds");
+ if v.size <= n then invalid_arg "Vect.get:index out of bounds";
v.elems.(n)
let get_last v n =
- if v.size <= n then raise
- (Invalid_argument "Vect.get:index out of bounds");
+ if v.size <= n then invalid_arg "Vect.get:index out of bounds";
v.elems.(v.size - n - 1)
let last v =
- if Int.equal v.size 0 then raise
- (Invalid_argument "Vect.last:index out of bounds");
+ if Int.equal v.size 0 then invalid_arg "Vect.last:index out of bounds";
v.elems.(v.size - 1)
let clear v = v.size <- 0
@@ -532,13 +529,13 @@ let empty_ids = [||]
let rec lambda_of_constr env c =
(* try *)
match kind_of_term c with
- | Meta _ -> raise (Invalid_argument "Nativelambda.lambda_of_constr: Meta")
- | Evar _ -> raise (Invalid_argument "Nativelambda.lambda_of_constr : Evar")
-
+ | Meta _ -> invalid_arg "Nativelambda.lambda_of_constr: Meta"
+ | Evar _ -> invalid_arg "Nativelambda.lambda_of_constr : Evar"
+
| Cast (c, _, _) -> lambda_of_constr env c
-
+
| Rel i -> Renv.get env i
-
+
| Var id -> Lvar id
| Sort s -> Lsort s
diff --git a/kernel/vm.ml b/kernel/vm.ml
index c6491c479..bc7116a35 100644
--- a/kernel/vm.ml
+++ b/kernel/vm.ml
@@ -249,9 +249,9 @@ let nargs : arguments -> int = fun args -> (Obj.size (Obj.repr args)) - 2
let arg args i =
if 0 <= i && i < (nargs args) then
val_of_obj (Obj.field (Obj.repr args) (i+2))
- else raise (Invalid_argument
+ else invalid_arg
("Vm.arg size = "^(string_of_int (nargs args))^
- " acces "^(string_of_int i)))
+ " acces "^(string_of_int i))
let apply_arguments vf vargs =
let n = nargs vargs in
@@ -488,7 +488,7 @@ let btag : vblock -> int = fun b -> Obj.tag (Obj.repr b)
let bsize : vblock -> int = fun b -> Obj.size (Obj.repr b)
let bfield b i =
if 0 <= i && i < (bsize b) then val_of_obj (Obj.field (Obj.repr b) i)
- else raise (Invalid_argument "Vm.bfield")
+ else invalid_arg "Vm.bfield"
(* Functions over vswitch *)