diff options
author | regisgia <regisgia@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2012-09-14 09:52:38 +0000 |
---|---|---|
committer | regisgia <regisgia@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2012-09-14 09:52:38 +0000 |
commit | 18ebb3f525a965358d96eab7df493450009517b5 (patch) | |
tree | 8a2488055203831506010a00bb1ac0bb6fc93750 /pretyping/coercion.ml | |
parent | 338608a73bc059670eb8196788c45a37419a3e4d (diff) |
The new ocaml compiler (4.00) has a lot of very cool warnings,
especially about unused definitions, unused opens and unused rec
flags.
The following patch uses information gathered using these warnings to
clean Coq source tree. In this patch, I focused on warnings whose fix
are very unlikely to introduce bugs.
(a) "unused rec flags". They cannot change the semantics of the program
but only allow the inliner to do a better job.
(b) "unused type definitions". I only removed type definitions that were
given to functors that do not require them. Some type definitions were
used as documentation to obtain better error messages, but were not
ascribed to any definition. I superficially mentioned them in one
arbitrary chosen definition to remove the warning. This is unaesthetic
but I did not find a better way.
(c) "unused for loop index". The following idiom of imperative
programming is used at several places: "for i = 1 to n do
that_side_effect () done". I replaced "i" with "_i" to remove the
warning... but, there is a combinator named "Util.repeat" that
would only cost us a function call while improving readibility.
Should'nt we use it?
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15797 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping/coercion.ml')
-rw-r--r-- | pretyping/coercion.ml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pretyping/coercion.ml b/pretyping/coercion.ml index 7418dbc3e..bd23501a8 100644 --- a/pretyping/coercion.ml +++ b/pretyping/coercion.ml @@ -75,7 +75,7 @@ let app_opt env evars f t = let pair_of_array a = (a.(0), a.(1)) let make_name s = Name (id_of_string s) -let rec disc_subset x = +let disc_subset x = match kind_of_term x with | App (c, l) -> (match kind_of_term c with @@ -102,7 +102,7 @@ let lift_args n sign = in liftrec (List.length sign) sign -let rec mu env isevars t = +let mu env isevars t = let rec aux v = let v' = hnf env !isevars v in match disc_subset v' with @@ -133,7 +133,7 @@ and coerce loc env isevars (x : Term.constr) (y : Term.constr) | [(na,b,t)], c -> (na,t), c | _ -> raise NoSubtacCoercion in - let rec coerce_application typ typ' c c' l l' = + let coerce_application typ typ' c c' l l' = let len = Array.length l in let rec aux tele typ typ' i co = if i < len then @@ -211,7 +211,7 @@ and coerce loc env isevars (x : Term.constr) (y : Term.constr) pair_of_array l, pair_of_array l' in let c1 = coerce_unify env a a' in - let rec remove_head a c = + let remove_head a c = match kind_of_term c with | Lambda (n, t, t') -> c, t' (*| Prod (n, t, t') -> t'*) |