ocaml/ocaml — pull request #111 by c-cube (2014-10-29 23:28:50+00:00)
Title: At tailcall

Add an attribute `[@tailcall]` such that `f args [@tailcall]` warns (with the new warning 50) if the call is not tail-recursive. See [the ocaml hacking item](https://github.com/ocamllabs/compiler-hacking/wiki/Things-to-work-on#add-support-for-tailcall-annotations).

The patch is twofold:
- A `Lapply` expression (in lambda code) is annotated with a record, rather than a location,
with a boolean within this record that specifies whether the call is expected to be in tail position. This flag
is set if the corresponding `Typedtree.expr` has a "tailcall" attribute.
- In `Simplif`, if the warning is enabled, tail calls are annotated, and if a call is expected to be in tail position
but isnt't, the warning is emitted.

Also added two tests in `testsuite/tests/warnings/`.