aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2017-04-07 09:49:21 +0200
committerGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2017-06-14 07:18:13 +0200
commit80dfe0cb64285f58dfe2eebd7319c747c70d3d6b (patch)
treed5a5a40add447479fb91a1a43e546d6c518d587f /lib
parent7e63c300a3aa1e3befb29bab9094e8b1939824bb (diff)
Add a version to be used when parsing compatibility notations mentioning old versions.
Diffstat (limited to 'lib')
-rw-r--r--lib/flags.ml38
-rw-r--r--lib/flags.mli2
2 files changed, 22 insertions, 18 deletions
diff --git a/lib/flags.ml b/lib/flags.ml
index 6a3b7a426..682e2e4df 100644
--- a/lib/flags.ml
+++ b/lib/flags.ml
@@ -106,32 +106,36 @@ let we_are_parsing = ref false
(* Current means no particular compatibility consideration.
For correct comparisons, this constructor should remain the last one. *)
-type compat_version = V8_2 | V8_3 | V8_4 | V8_5 | V8_6 | Current
+type compat_version = VOld | V8_2 | V8_3 | V8_4 | V8_5 | V8_6 | Current
let compat_version = ref Current
let version_compare v1 v2 = match v1, v2 with
-| V8_2, V8_2 -> 0
-| V8_2, (V8_3 | V8_4 | V8_5 | V8_6 | Current) -> -1
-| V8_3, V8_2 -> 1
-| V8_3, V8_3 -> 0
-| V8_3, (V8_4 | V8_5 | V8_6 | Current) -> -1
-| V8_4, (V8_2 | V8_3) -> 1
-| V8_4, V8_4 -> 0
-| V8_4, (V8_5 | V8_6 | Current) -> -1
-| V8_5, (V8_2 | V8_3 | V8_4) -> 1
-| V8_5, V8_5 -> 0
-| V8_5, (V8_6 | Current) -> -1
-| V8_6, (V8_2 | V8_3 | V8_4 | V8_5) -> 1
-| V8_6, V8_6 -> 0
-| V8_6, Current -> -1
-| Current, Current -> 0
-| Current, (V8_2 | V8_3 | V8_4 | V8_5 | V8_6) -> 1
+ | VOld, VOld -> 0
+ | VOld, _ -> -1
+ | _, VOld -> 1
+ | V8_2, V8_2 -> 0
+ | V8_2, _ -> -1
+ | _, V8_2 -> 1
+ | V8_3, V8_3 -> 0
+ | V8_3, _ -> -1
+ | _, V8_3 -> 1
+ | V8_4, V8_4 -> 0
+ | V8_4, _ -> -1
+ | _, V8_4 -> 1
+ | V8_5, V8_5 -> 0
+ | V8_5, _ -> -1
+ | _, V8_5 -> 1
+ | V8_6, V8_6 -> 0
+ | V8_6, _ -> -1
+ | _, V8_6 -> 1
+ | Current, Current -> 0
let version_strictly_greater v = version_compare !compat_version v > 0
let version_less_or_equal v = not (version_strictly_greater v)
let pr_version = function
+ | VOld -> "old"
| V8_2 -> "8.2"
| V8_3 -> "8.3"
| V8_4 -> "8.4"
diff --git a/lib/flags.mli b/lib/flags.mli
index e2cf09474..c0aca9c99 100644
--- a/lib/flags.mli
+++ b/lib/flags.mli
@@ -77,7 +77,7 @@ val raw_print : bool ref
(* Univ print flag, never set anywere. Maybe should belong to Univ? *)
val univ_print : bool ref
-type compat_version = V8_2 | V8_3 | V8_4 | V8_5 | V8_6 | Current
+type compat_version = VOld | V8_2 | V8_3 | V8_4 | V8_5 | V8_6 | Current
val compat_version : compat_version ref
val version_compare : compat_version -> compat_version -> int
val version_strictly_greater : compat_version -> bool