Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

melange: the compiler does not support -bin-annot-occurrences #10622

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions src/dune_rules/module_compilation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,20 @@ let build_cm
(Action_builder.map module_deps ~f:(other_cm_files ~opaque ~cm_kind ~obj_dir))
in
let other_targets, cmt_args =
match cm_kind with
| Ocaml Cmx -> other_targets, Command.Args.empty
| Ocaml (Cmi | Cmo) | Melange (Cmi | Cmj) ->
if Compilation_context.bin_annot cctx
then (
let fn =
Option.value_exn (Obj_dir.Module.cmt_file obj_dir m ~cm_kind ~ml_kind)
in
let annots =
[ "-bin-annot" ]
@
if Version.supports_bin_annot_occurrences ocaml.version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just maintaining the old code but introducing:

let supports_bin_annot_occurences = Version.supports_bin_annot_occurences ocaml.version && not cm_kind <> Melange in

then [ "-bin-annot-occurrences" ]
else []
in
fn :: other_targets, As annots)
else other_targets, Command.Args.empty
match Compilation_context.bin_annot cctx, cm_kind with
| false, _ | true, Ocaml Cmx -> other_targets, Command.Args.empty
| true, Ocaml (Cmi | Cmo) ->
let fn = Option.value_exn (Obj_dir.Module.cmt_file obj_dir m ~cm_kind ~ml_kind) in
let annots =
if Version.supports_bin_annot_occurrences ocaml.version
then [ "-bin-annot"; "-bin-annot-occurrences" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spurious change? the previous version did not duplicate the flag name here

else [ "-bin-annot" ]
in
fn :: other_targets, As annots
| true, Melange (Cmi | Cmj) ->
let fn = Option.value_exn (Obj_dir.Module.cmt_file obj_dir m ~cm_kind ~ml_kind) in
let annots = [ "-bin-annot" ] in
fn :: other_targets, As annots
in
let opaque_arg : _ Command.Args.t =
let intf_only = cm_kind = Ocaml Cmi && not (Module.has m ~ml_kind:Impl) in
Expand Down
Loading