Hi there,
I am wondering how to use the [@inlined]
attribute (that checks that a function call is inlined by the compiler) with dune
. It seems that the dev
profile of dune
inhibits cross-module function inlining completely.
Here is an example.
File a.ml
contains
let[@inline] f x = x
and file b.ml
contains
let x = (A.f[@inlined]) 42
When I build the project with the release
profile using dune build --profile release
everything works fine: no warning is emitted, which means that the call to A.f
is effectively inlined.
However, with the dev
profile (which is the default) the warning 55 is triggered:
$ dune build
File "b.ml", line 1, characters 8-26:
1 | let x = (A.f[@inlined]) 42
^^^^^^^^^^^^^^^^^^
Error (warning 55 [inlining-impossible]): Cannot inline: Unknown function
Should warning 55 be turned off by default in dev profile?
Do you have any other suggestion? Or am I missing something?
EDIT: I have just noticed there is an open issue in dune related to this problem.