Skip to content

Commit

Permalink
Magic numbers for cmx and cmxa files (ocaml-flambda#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
xclerc committed Jul 26, 2021
1 parent 0cc87aa commit 091346f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions ocaml/utils/config.mlp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ and cmi_magic_number = "Caml1999I029"
and cmo_magic_number = "Caml1999O029"
and cma_magic_number = "Caml1999A029"
and cmx_magic_number =
if flambda then
"Caml1999y029"
if flambda || flambda2 then
"Caml2021y029"
else
"Caml1999Y029"
"Caml2021Y029"
and cmxa_magic_number =
if flambda then
"Caml1999z029"
if flambda || flambda2 then
"Caml2021z029"
else
"Caml1999Z029"
"Caml2021Z029"
and ast_impl_magic_number = "Caml1999M029"
and ast_intf_magic_number = "Caml1999N029"
and cmxs_magic_number = "Caml1999D029"
Expand Down
16 changes: 8 additions & 8 deletions ocaml/utils/misc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -981,10 +981,10 @@ module Magic_number = struct
| "Caml1999I" -> Some Cmi
| "Caml1999O" -> Some Cmo
| "Caml1999A" -> Some Cma
| "Caml1999y" -> Some (Cmx {flambda = true})
| "Caml1999Y" -> Some (Cmx {flambda = false})
| "Caml1999z" -> Some (Cmxa {flambda = true})
| "Caml1999Z" -> Some (Cmxa {flambda = false})
| "Caml2021y" -> Some (Cmx {flambda = true})
| "Caml2021Y" -> Some (Cmx {flambda = false})
| "Caml2021z" -> Some (Cmxa {flambda = true})
| "Caml2021Z" -> Some (Cmxa {flambda = false})

(* Caml2007D and Caml2012T were used instead of the common Caml1999 prefix
between the introduction of those magic numbers and October 2017
Expand All @@ -1009,12 +1009,12 @@ module Magic_number = struct
| Cma -> "Caml1999A"
| Cmx config ->
if config.flambda
then "Caml1999y"
else "Caml1999Y"
then "Caml2021y"
else "Caml2021Y"
| Cmxa config ->
if config.flambda
then "Caml1999z"
else "Caml1999Z"
then "Caml2021z"
else "Caml2021Z"
| Cmxs -> "Caml1999D"
| Cmt -> "Caml1999T"
| Ast_impl -> "Caml1999M"
Expand Down

0 comments on commit 091346f

Please sign in to comment.