Warnings emitted by the compiler may contain \r\r\n on Windows (MPR#7106)#370
Warnings emitted by the compiler may contain \r\r\n on Windows (MPR#7106)#370damiendoligez merged 2 commits intoocaml:trunkfrom
Conversation
Stray `\r` characters included in the attribute when parsed on Windows. Fixed by specifying that deprecated_module.mli must be checked out with LF endings.
|
Thanks! Since this is not performance critical, it seems the code could be made much simpler by using a single pass, creating the result with Buffer.add_char. |
|
Yeah, it was one of those things that seemed like a good idea when I started writing it! Given that I've almost certainly written that function 2 or 3 times before, can I make a case for it usefully being in the standard library (and therefore preferring the two-scan but only one copy rather than single-scan, two copy version with |
|
It's delicate to change the standard library because there is no clear consensus on where we want to go with it, and the current peace treaty ("only the obvious functions") does not justify adding this one. Feel free to move this to |
|
I didn't know about that module - I'd incorrectly thought that being used in the compiler made it a potential candidate! I'll move it there and add tests in |
|
First of all, this isn't solving the real problem, it's just sweeping the dust under the rug. The real problem is not \r\n in warnings, it's naked newlines in string constants, whose semantics changes when git translates \n into \r\n. Programs with variables semantics are bad news, especially when the change is invisible. The problem was solved a few years ago for normal strings by introducing warning 29. This solution obviously doesn't apply to quoted strings. Any ideas? Then, if you want to fix it at the warning level, I have two remarks:
You could also simply fix the test by using a normal string as the annotation payload. |
|
OK, I was under the impression from dra27@3985349#commitcomment-15122153 that the inclusion of the |
I was only describing the current state.
The problem is for quoted strings, where we expect a byte-level correspondence between whatever is in the source code and what is kept in the AST. |
|
Sorry, the way I phrased that was unnecessarily defensive. There are two options that "fix" the test and therefore truly sweep up the dust:
Both options dismiss this PR and hopefully expedite the merging of #366 (which is what I'm originally after...). Does that the leave the MPR as something that wants fixing at some point? |
The message is only to be used for display, so I really think the simple solution is better. |
|
OK - it shouldn't ever be relevant here, but my thoughts/over-engineering are probably influenced by porting work in OPAM, where |
|
By adding it to the 4.03 milestone, I just mean I think it should/will be resolved before 4.03.0. I agree altering the test suite is not a satisfactory solution, and I won't fight for the simple version of CR removal. I'll merge this PR as soon as you:
|
ac098c2 to
b5e1a49
Compare
|
Happy New Year! Changes made. I apologise for creating the appearance of a fight - it's definitely your project (which I don't mean in the double-meaning that various guides as to what the British say vs. what they mean might suggest!) - I was going to put |
utils/misc.mli
Outdated
There was a problem hiding this comment.
😊 Really should install full vim in the VM so I have the spell-checker...
b5e1a49 to
e641061
Compare
e641061 to
726b47e
Compare
|
There are more important topics, but what about doing the simpler version of removing all \r characters, but only as a rewriting for the payload string of the deprecated attribute? |
The formatters used for printing warnings have text mode translation enabled which means that any Windows endings which creep into warning texts (e.g. from attributes) result in \r\r\n in the output. The effect is largely innocuous, except that it causes the deprecated_module_use test to fail on Windows.
The formatters used for printing warnings have text mode translation enabled which means that any Windows endings which creep into warning texts from deprecated attributes result in \r\r\n in the output. The effect is largely innocuous, except that it causes the deprecated_module_use test to fail on Windows.
726b47e to
469810f
Compare
|
Rebased with a second commit to show the changes - up to you if you would like it squashed or merged as two. |
PR#7106: Warnings emitted by the compiler may contain \r\r\n on Windows
|
@dra27 thanks for putting up with our nitpicking :-) |
Remove Cloadmut and Iloadmut
* fixing title case * fixed another title case header Signed-off-by: Christine Rose <professor.rose@gmail.com>
See http://caml.inria.fr/mantis/view.php?id=7106