aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEnrico Tassi2017-10-03 17:41:12 +0200
committerEnrico Tassi2017-10-03 17:41:12 +0200
commitef5aeafb74e33be6ac5b93a9713a3769f5917bd6 (patch)
tree1019412aa7a4b4466df54dedab0f49845ee51a57 /tools
parent0cc07dd290eb85bbb167dae2985cd1e468df882c (diff)
fix compilation on OCaml < 4.04
Diffstat (limited to 'tools')
-rw-r--r--tools/coqmktop.ml13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/coqmktop.ml b/tools/coqmktop.ml
index 524fe63232..c21db300ad 100644
--- a/tools/coqmktop.ml
+++ b/tools/coqmktop.ml
@@ -252,6 +252,17 @@ let create_tmp_main_file modules =
with reraise ->
clean main_name; raise reraise
+(* TODO: remove once OCaml 4.04 is adopted *)
+let split_on_char sep s =
+ let r = ref [] in
+ let j = ref (String.length s) in
+ for i = String.length s - 1 downto 0 do
+ if s.[i] = sep then begin
+ r := String.sub s (i + 1) (!j - i - 1) :: !r;
+ j := i
+ end
+ done;
+ String.sub s 0 !j :: !r
(** {6 Main } *)
@@ -272,7 +283,7 @@ let main () =
(* - We add topstart.cmo explicitly because we shunted ocamlmktop wrapper.
- With the coq .cma, we MUST use the -linkall option. *)
let coq_camlflags =
- List.filter ((<>) "") (String.split_on_char ' ' Coq_config.caml_flags) in
+ List.filter ((<>) "") (split_on_char ' ' Coq_config.caml_flags) in
let args =
coq_camlflags @ "-linkall" :: "-w" :: "-31" :: flags @ copts @ options @
(std_includes basedir) @ tolink @ [ main_file ] @ topstart