Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copy# for Microsoft C compiler #353

Merged
merged 3 commits into from
Dec 22, 2017
Merged

Fix copy# for Microsoft C compiler #353

merged 3 commits into from
Dec 22, 2017

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Dec 7, 2017

Microsoft CL doesn't support #n and requires the more strictly correct directive #line. I've done this by changing the behaviour of copy# depending on the file extension.

src/path.ml Outdated
let l = String.length t' in
String.sub t ~pos:l ~len:(String.length t - l)
with Not_found ->
""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use Filename.extension from Import here instead of writing your own function. Or just not have a wrapper at all. Your call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hackathon wine had clearly got to me by that point, and I forgot that Filename is extended in import.ml. I've renamed it to extension as an alias (I prefer to have the extra function, because then you don't have to cast the path itself to a string in order to use Filename.extension)

@rgrinberg
Copy link
Member

Also, would you mind updating the copy-files blackbox tests with this? I don't think you have to build any C stubs btw, just depend on the target C source and make sure that the directives are correct.

@dra27
Copy link
Member Author

dra27 commented Dec 15, 2017

That seems to exercise it - how does that look to you @rgrinberg?

Microsoft CL doesn't support #n and requires the more strictly correct
directive #line

Signed-off-by: David Allsopp <[email protected]>
Tests that the the directive emits #line instead of #n.

Signed-off-by: David Allsopp <[email protected]>
@rgrinberg
Copy link
Member

@dra27 Almost. I've improved the test further so that we actually track that the copied file has the necessary line. Feel free to merge if you find this acceptable.

@dra27 dra27 merged commit f365e8f into ocaml:master Dec 22, 2017
@dra27
Copy link
Member Author

dra27 commented Dec 22, 2017

Good change, thanks!

@dra27 dra27 deleted the fix-copy# branch December 22, 2017 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants