Skip to content

Commit 11fd79a

Browse files
authored
Misc: OCaml 4.04 as lower bound (#1124)
1 parent 69c9048 commit 11fd79a

20 files changed

+31
-63
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515
os:
1616
- ubuntu-latest
1717
ocaml-compiler:
18-
- 4.02.x
19-
- 4.03.x
2018
- 4.04.x
2119
- 4.05.x
2220
- 4.06.x

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## Features/Changes
33
* Compiler: add support for OCaml 4.13
44
* Compiler: new tool to check for missing primitives
5+
* Compiler: drop support for OCaml 4.03 and bellow
56
* Lib: add offsetX and offsetY to Dom_html.mouseEvent
67
* Lib: add innerText property for Dom_html
78
* Runtime: add dummy implementation for many dummy primitives

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ comparison, and hashing functions can yield results different from usual:
9696

9797
## Toplevel
9898

99-
- [OCaml 4.02.3](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.02.3)
100-
- [OCaml 4.03.0](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.03.0)
10199
- [OCaml 4.04.2](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.04.2)
102100
includes Base, Core_kernel, Async_kernel, Async_js
103101
- [OCaml 4.04.0+BER](http://ocsigen.github.io/js_of_ocaml/toplevel.html#version=4.04.0+BER)

compiler/lib/instr.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ type desc =
197197
let ops =
198198
let if_v407 =
199199
match Ocaml_version.v with
200-
| `V4_02 | `V4_03 | `V4_04 | `V4_06 -> fun _ -> K_will_not_happen
200+
| `V4_04 | `V4_06 -> fun _ -> K_will_not_happen
201201
| `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 | `V4_12 | `V4_13 -> fun k -> k
202202
in
203203
let instrs =

compiler/lib/magic_number.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let equal a b = compare a b = 0
6666
let current_exe =
6767
let v =
6868
match Ocaml_version.v with
69-
| `V4_02 | `V4_03 | `V4_04 -> 11
69+
| `V4_04 -> 11
7070
| `V4_06 -> 11
7171
| `V4_07 -> 23
7272
| `V4_08 -> 25
@@ -81,8 +81,7 @@ let current_exe =
8181
let current_cmo =
8282
let v =
8383
match Ocaml_version.v with
84-
| `V4_02 -> 10
85-
| `V4_03 | `V4_04 -> 11
84+
| `V4_04 -> 11
8685
| `V4_06 -> 22
8786
| `V4_07 -> 23
8887
| `V4_08 -> 25
@@ -97,8 +96,7 @@ let current_cmo =
9796
let current_cma =
9897
let v =
9998
match Ocaml_version.v with
100-
| `V4_02 -> 11
101-
| `V4_03 | `V4_04 -> 12
99+
| `V4_04 -> 12
102100
| `V4_06 -> 22
103101
| `V4_07 -> 23
104102
| `V4_08 -> 25

compiler/lib/ocaml_version.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ let rec compare v v' =
6565
| n -> n)
6666

6767
let v =
68-
if compare current [ 4; 3 ] < 0
69-
then `V4_02
70-
else if compare current [ 4; 4 ] < 0
71-
then `V4_03
68+
if compare current [ 4; 4 ] < 0
69+
then failwith "OCaml version unsupported"
7270
else if compare current [ 4; 6 ] < 0
7371
then `V4_04
7472
else if compare current [ 4; 7 ] < 0

compiler/lib/ocaml_version.mli

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ val compare : t -> t -> int
2525
val split : string -> t
2626

2727
val v :
28-
[ `V4_02 (* OCaml 4.02 *)
29-
| `V4_03 (* OCaml 4.03 *)
30-
| `V4_04 (* OCaml 4.04 / OCaml 4.05 *)
28+
[ `V4_04 (* OCaml 4.04 / OCaml 4.05 *)
3129
| `V4_06 (* OCaml 4.06 *)
3230
| `V4_07 (* OCaml 4.07 *)
3331
| `V4_08 (* OCaml 4.08 *)

compiler/lib/parse_bytecode.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,7 @@ let method_cache_id = ref 1
750750

751751
let new_closure_repr =
752752
match Ocaml_version.v with
753-
| `V4_02 | `V4_03 | `V4_04 | `V4_06 | `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 ->
754-
false
753+
| `V4_04 | `V4_06 | `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 -> false
755754
| `V4_12 | `V4_13 -> true
756755

757756
let clo_offset_3 = if new_closure_repr then 3 else 2
@@ -2123,8 +2122,7 @@ let parse_bytecode code globals debug_data =
21232122
let override_global =
21242123
match Ocaml_version.v with
21252124
| `V4_13 -> []
2126-
| `V4_02 | `V4_03 | `V4_04 | `V4_06 | `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11
2127-
| `V4_12 ->
2125+
| `V4_04 | `V4_06 | `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 | `V4_12 ->
21282126
let jsmodule name func =
21292127
Prim (Extern "%overrideMod", [ Pc (String name); Pc (String func) ])
21302128
in

compiler/tests-re/test_str.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,7 @@ module Fmt = struct
2929

3030
type 'a t = Format.formatter -> 'a -> unit
3131

32-
(* Only in the stdlib since 4.02, so we copy. *)
33-
let rec list ?(pp_sep = pp_print_cut) pp ppf = function
34-
| [] -> ()
35-
| [v] -> pp ppf v
36-
| v :: vs ->
37-
pp ppf v;
38-
pp_sep ppf ();
39-
list ~pp_sep pp ppf vs
40-
41-
(* want this name to make sure we don't use pp_print_list from stdlib
42-
accidentally *)
43-
let pp_print_list = list
32+
let list = pp_print_list
4433

4534
let str = pp_print_string
4635
let sexp fmt s pp x = fprintf fmt "@[<3>(%s@ %a)@]" s pp x

dune-project

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
(description
1919
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
2020
(depends
21-
(ocaml (and (>= 4.02) (< 4.14)))
21+
(ocaml (and (>= 4.04) (< 4.14)))
2222
(num :with-test)
2323
(ppx_expect (and (>= v0.12.0) :with-test))
2424
(ppxlib (>= 0.15.0))
@@ -41,7 +41,7 @@
4141
(description
4242
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
4343
(depends
44-
(ocaml (>= 4.03))
44+
(ocaml (>= 4.04))
4545
(js_of_ocaml (= :version))
4646
(js_of_ocaml-ppx (= :version))
4747
(lwt (>= 2.4.4))
@@ -60,7 +60,7 @@
6060
(description
6161
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
6262
(depends
63-
(ocaml (>= 4.03))
63+
(ocaml (>= 4.04))
6464
ocamlbuild
6565
(num :with-test)
6666
(ppx_expect :with-test)
@@ -88,7 +88,7 @@
8888
(description
8989
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
9090
(depends
91-
(ocaml (>= 4.02))
91+
(ocaml (>= 4.04))
9292
(js_of_ocaml (= :version))
9393
(ppxlib (>= 0.15.0))
9494
(num :with-test)
@@ -102,7 +102,7 @@
102102
(description
103103
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
104104
(depends
105-
(ocaml (>= 4.02))
105+
(ocaml (>= 4.04))
106106
(js_of_ocaml (= :version))
107107
(js_of_ocaml-compiler (= :version))
108108
(js_of_ocaml-ppx (= :version))
@@ -121,7 +121,7 @@
121121
(description
122122
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
123123
(depends
124-
(ocaml (>= 4.02))
124+
(ocaml (>= 4.04))
125125
(js_of_ocaml (= :version))
126126
(js_of_ocaml-ppx (= :version))
127127
(react (>= 1.2.1))
@@ -139,7 +139,7 @@
139139
(description
140140
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
141141
(depends
142-
(ocaml (>= 4.02))
142+
(ocaml (>= 4.04))
143143
(js_of_ocaml-compiler (= :version))
144144
(ppxlib (>= 0.15))
145145
uchar

0 commit comments

Comments
 (0)