Do you have instructions that we could use to reproduce your issue ? The warning 55 is expected, but not warning 53 (this is supposed to be the correct place to put an inlining annotation). I’m particularly interested to know if this issue occurs with recent versions of the compiler (4.14 or 5.0).
You still need to disable warning 55 though, and it seems it can’t be disabled from within the generated file. I might remove the remaining annotations too to get rid of these warnings; I don’t think anyone is actually using capnproto with flambda or cares about the minor speed boost anyway.
Can you make an issue on the compiler for the misplaced attribute warnings ? The ones that you removed in your PR are definitely not misplaced, so it’s likely a bug somewhere in the compiler if a warning is emitted.
$ cat test.ml
[@@@ocaml.warning "-53-55"]
module M = struct let t = object end end [@@inline]
$ ocamlopt ./test.ml
File "./test.ml", line 2, characters 44-50:
2 | module M = struct let t = object end end [@@inline]
^^^^^^
Warning 53 [misplaced-attribute]: the "inline" attribute cannot appear in this context
Ok, so there are two different bugs.
The first one is that [@@@ocaml.warning "-53"] doesn’t work. This is not completely surprising, but it might not be that hard to fix.
The second one is that for functors containing classes or objects, the [@@inline] attribute doesn’t get attached to the functor correctly. I have an idea of why, but I’ll need some time to make a proper fix.
I’ll submit bug reports for those issues so that we can track them properly. Thanks for providing the example.