Conversation
I have a more semantic/indirect definition for what |
typing/cmt_format.ml
Outdated
There was a problem hiding this comment.
This code is duplicated twice, here and in Env. Would it make sense to factorize it into a Cmi_format.global_pers_flags () function?
Also with my nitpicking hat on, I think you could factorize this as
[]
@ (if !Clflags.recursive_types then [Cmi_format.Rectypes] else [])
@ (if !Clflags.opaque then [Cmi_format.Opaque] else [])|
I like the feature, and the code seems fairly simple and very reasonable. In favor. |
I would actually go further and define it in terms of being able to choose between different implementations at link-time. |
|
I'll tidy up the code, warning message and changes file this evening. |
|
I wanted to merge this PR right now, but in fact it now conflicts with @alainfrisch 's change on compilation unit deprecation. Could you rebase the patchset against the current trunk? In addition, it would be nice if you could:
|
utils/warnings.ml
Outdated
|
I've fixed the message, rebased and added tests for both |
typing/env.ml
Outdated
There was a problem hiding this comment.
this last line should be parenthesized or use begin .. end.
|
Nice PR, thanks! |
|
@lpw25 with more usage experience, there is one aspect of this change that I'm not fully satisfied with: it is the fact that I think that with your change, we should add |
|
I completely agree, in fact I consider this to be a bug as it was not intentional. However, I'm not sure that I'll have time to look at this in the next few days. |
|
ping |
Co-authored-by: Rahul Kumar <rkumar85@bloomberg.net>
This patch adds a warning for missing cmx files during cross-module inlining. This is useful because currently a misspecified build can silently damage the performance of programs.
The patch also extends the
-opaqueoption to work on .mli files. Using-opaqueon an .ml file means that its implementation should not be considered for cross-module inlining. Using-opaqueon an .mli file means that no implementation of that interface should be considered for cross-module inlining.If an interface is marked as
opaquethen the compiler does not search for a .cmx file, and so the new warning will not be triggered. This means that modules which are intended to be chosen at link-time (and so deliberately hide .cmx files) can avoid unnecessarily triggering the warning.As an illustration of the utility of this new warning, not all cmx files were installed by the OCaml distribution, and the patch also adjusts the installation rules to install these files (which were in compiler-libs and ocamldoc).