Skip to content

Commit

Permalink
[ocaml] 5.2.1
Browse files Browse the repository at this point in the history
Summary: Upgrade to OCaml 5.2.1.

Reviewed By: jvillard

Differential Revision:
D66591244

Privacy Context Container: L1208441

fbshipit-source-id: 242cf47e4fc7a672579220f42a5bc8cdb6114798
  • Loading branch information
ngorogiannis authored and facebook-github-bot committed Dec 2, 2024
1 parent 89ba61b commit 1111574
Show file tree
Hide file tree
Showing 13 changed files with 315 additions and 310 deletions.
8 changes: 3 additions & 5 deletions build-infer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ DEPENDENCIES_DIR="$INFER_ROOT/facebook/dependencies"
PLATFORM="$(uname)"
SANDCASTLE=${SANDCASTLE:-}
NCPU="$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)"
INFER_OPAM_DEFAULT_SWITCH="4.14.0+flambda"
INFER_OPAM_DEFAULT_SWITCH_OPTIONS="--package=ocaml-variants.4.14.0+options,ocaml-option-flambda"
INFER_OPAM_DEFAULT_SWITCH="5.2.1+flambda"
INFER_OPAM_DEFAULT_SWITCH_OPTIONS="--package=ocaml-variants.5.2.1+options,ocaml-option-flambda"
INFER_OPAM_SWITCH=${INFER_OPAM_SWITCH:-$INFER_OPAM_DEFAULT_SWITCH}
INFER_OPAM_SWITCH_OPTIONS=${INFER_OPAM_SWITCH_OPTIONS:-$INFER_OPAM_DEFAULT_SWITCH_OPTIONS}
PLUGIN_DIR="$INFER_ROOT/facebook-clang-plugins"
Expand Down Expand Up @@ -171,9 +171,7 @@ install_opam_deps () {
if [ "$USE_OPAM_LOCK" == yes ]; then
locked=.locked
fi
if [ -z "$SANDCASTLE" ] ; then
opam pin add --no-action stdcompat "$INFER_ROOT"/dependencies/stdcompat
fi
opam pin add --no-action stdcompat "$INFER_ROOT"/dependencies/stdcompat
opam install --deps-only "$INFER_ROOT"/opam/infer.opam$locked
}

Expand Down
6 changes: 3 additions & 3 deletions dependencies/ocamldot/ocamldot.mll
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rule processSource = parse
let i = String.rindex s '.' in
let s = String.sub s 0 i in
let s = Filename.basename s in
let s = String.capitalize s in
let s = String.capitalize_ascii s in
currentSource := s;
processTargets lexbuf }
| eof
Expand All @@ -43,7 +43,7 @@ and processTargets = parse
let i = String.rindex t '.' in
let t = String.sub t 0 i in
let t = Filename.basename t in
let t = String.capitalize t in
let t = String.capitalize_ascii t in
addDepend t;
processTargets lexbuf }
| eof
Expand Down Expand Up @@ -319,7 +319,7 @@ let dir_to_mod_names graph dir =
) StringSet.empty graph in
fold_dir (fun dir_to_mod_names path ->
let file = Filename.basename path in
let mod_name = String.capitalize (try Filename.chop_extension file with _ -> file) in
let mod_name = String.capitalize_ascii (try Filename.chop_extension file with _ -> file) in
if ((Filename.check_suffix file ".ml")
&& StringSet.mem mod_name nodes)
then
Expand Down
2 changes: 2 additions & 0 deletions infer/src/dune.common.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ let facebook = is_yes "@IS_FACEBOOK_TREE@"
let extra_cflags = if is_empty "@EXTRA_CFLAGS@" then [] else ["@EXTRA_CFLAGS@"]

let windows = is_yes "@WINDOWS_BUILD@"

let darwin = String.equal "@BUILD_PLATFORM@" "Darwin"
8 changes: 6 additions & 2 deletions infer/src/dune.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ let strict_flags =
ocamlc_flags @ ["-w"; warnings; "-warn-error"; fatal_warnings] |> String.concat " "


(* OCaml 5.2 on macos with -O3 can lead to compilation failing
https://github.com/ocaml/ocaml/issues/13596 *)
let ocamlopt_flags_val = if darwin then "(:standard -O2)" else "(:standard -O3)"

let env_stanza =
Format.sprintf
{|
Expand All @@ -47,13 +51,13 @@ let env_stanza =
(inline_tests enabled))
(opt
(flags %s)
(ocamlopt_flags (:standard -O3)))
(ocamlopt_flags %s))
(dev-noerror
(flags %s)
(inline_tests enabled))
)
|}
strict_flags lenient_flags lenient_flags
strict_flags lenient_flags ocamlopt_flags_val lenient_flags


(** Put this *first* in (libraries) specifications to prevent a clash between extlib's and base64's
Expand Down
8 changes: 4 additions & 4 deletions infer/src/linking-flags.sexp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
; 2. Check the dune logs in infer/_build/log. At the very end is the linking command, which
; contains linking directives starting with `-l`, e.g.
;
; '-lcamlstr' '-lzarith' '-lgmp' '-lcamlzip' '-lz' '-lsqlite3_stubs' '-lsqlite3' '-lparmap_stubs' '-lmtime_clock_stubs' '-lrt' '-lfilename_unix_stubs' '-lsys_unix_stubs' '-lcore_unix_stubs' '-lspawn_stubs' '-lsignal_unix_stubs' '-lerror_checking_mutex_stubs' '-lthreadsnat' '-lpthread' '-lANSITerminal_stubs' '-lpyml_stubs' '-lstdcompat_stubs' '-lcore_stubs' '-lheap_block_stubs' '-lbase_bigstring_stubs' '-lunix' '-lexpect_test_collector_stubs' '-ltime_now_stubs' '-lbin_prot_stubs' '-lbase_stubs' '-lbase_internalhash_types_stubs' '/home/nikosg/.opam/4.14.0+flambda/lib/ocaml/libasmrun.a' -lm
; '-lcamlstrnat' '-lcomprmarsh' '-lzarith' '-lgmp' '-lcamlzip' '-lz' '-lsqlite3_stubs' '-lsqlite3' '-lparmap_stubs' '-lmtime_clock_stubs' '-lrt' '-lfilename_unix_stubs' '-lsys_unix_stubs' '-lcore_unix_stubs' '-lspawn_stubs' '-lsignal_unix_stubs' '-lerror_checking_mutex_stubs' '-lthreadsnat' '-lANSITerminal_stubs' '-lpyml_stubs' '-lstdcompat_stubs' '-lunixnat' '-lcore_stubs' '-lheap_block_stubs' '-lbase_bigstring_stubs' '-lexpect_test_collector_stubs' '-ltime_now_stubs' '-lbin_prot_stubs' '-lbase_stubs' '-lbase_internalhash_types_stubs'
;
; 3. Copy those below as follows: Keep the flags the same until the dynamic section after
; `-cclib -Wl,-Bdynamic`. The flags already included are for static libraries; we want to keep
Expand All @@ -29,12 +29,12 @@
-cclib -Wl,-Bstatic
-cclib -lzarith -cclib -lgmp -cclib -lsqlite3_stubs -cclib -lsqlite3
-cclib -Wl,-Bdynamic
-cclib -lcamlzip -cclib -lz -cclib -lpthread -cclib -lparmap_stubs
-cclib -lmtime_clock_stubs -cclib -lrt -cclib -lcamlstr -cclib -lfilename_unix_stubs
-cclib -lcomprmarsh -cclib -lcamlzip -cclib -lz -cclib -lpthread -cclib -lparmap_stubs
-cclib -lmtime_clock_stubs -cclib -lrt -cclib -lcamlstrnat -cclib -lfilename_unix_stubs
-cclib -lsys_unix_stubs -cclib -lcore_unix_stubs -cclib -lspawn_stubs -cclib -lsignal_unix_stubs
-cclib -lerror_checking_mutex_stubs -cclib -lthreadsnat -cclib -lpthread
-cclib -lANSITerminal_stubs -cclib -lpyml_stubs -cclib -lstdcompat_stubs -cclib -lcore_stubs -cclib -lheap_block_stubs
-cclib -lbase_bigstring_stubs -cclib -lexpect_test_collector_stubs -cclib -ltime_now_stubs
-cclib -lbin_prot_stubs -cclib -lunix -cclib -lbase_stubs -cclib -lbase_internalhash_types_stubs
-cclib -lbin_prot_stubs -cclib -lunixnat -cclib -lbase_stubs -cclib -lbase_internalhash_types_stubs
-cclib -lasmrun -cclib -lm -cclib -ldl
)
4 changes: 2 additions & 2 deletions infer/src/python/unit/PyIRTest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ def g(l):
in
PyIR.test source ;
[%expect
{xxx|
{|
module dummy:

function toplevel():
Expand Down Expand Up @@ -1410,7 +1410,7 @@ def g(l):
jmp b1

b3:
return $BuildMap() |xxx}]
return $BuildMap() |}]


let%expect_test _ =
Expand Down
9 changes: 4 additions & 5 deletions infer/src/python/unit/PyIRTestBasic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ d = { 0x78: "abc", # 1-n decoding mapping
in
PyIR.test source ;
[%expect
{xxx|
{|
module dummy:

function toplevel():
Expand All @@ -298,7 +298,7 @@ d = { 0x78: "abc", # 1-n decoding mapping
n8 <- $Call(n5, n7, None)
n9 <- $BuildConstKeyMap($BuildTuple(120, "abc", 1, 121), "abc", 120, None, "", None)
TOPLEVEL[d] <- n9
return None |xxx}]
return None |}]


let%expect_test _ =
Expand Down Expand Up @@ -433,7 +433,7 @@ x = o.f(0, *args1, *args2, **d1, **d2)
in
PyIR.test source ;
[%expect
{xxx|
{|
module dummy:
function toplevel():
Expand Down Expand Up @@ -524,8 +524,7 @@ x = o.f(0, *args1, *args2, **d1, **d2)
n70 <- $DictMerge($BuildMap(), n69, None)
n71 <- $CallFunctionEx(n61, n66, $BuildMap(), None)
TOPLEVEL[x] <- n71
return None
|xxx}]
return None |}]
let%expect_test _ =
Expand Down
Loading

0 comments on commit 1111574

Please sign in to comment.