parsing/Location.prerr_warning is hard-coded to use Format.err_formatter #5271
Original bug ID: 5271
I have embedded a REPL in a third-party application. Things that issue errors are properly printed as errors, i.e.:
However, things that issue warnings instead give general errors about bad I/O descriptors:
I tracked down the cause of this behavior to parsing/location.ml, in the function prerr_warning:
For my purposes, I was able to change err_formatter to std_formatter, and I obtain the proper compiler warnings in my toplevel. In general, it would be nice if the source was changed upstream somehow such that such warnings were redirected into the functions I had registered using Format.set_formatter_output_functions.
Comment author: rrolles
I know this bug does not seem very sexy or important given its modest description. However, it not being fixed means that users of my program IDAOCaml (an OCaml REPL for a third-party application) have to modify OCaml and recompile it from scratch. If it was fixed, they could just use the binary distribution. Pretty please?