Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Get rid of the direct call to the C preprocessor in the testsuite #8528
This is a follow-up to #2311.
Call the C preprocessor through the C compiler rather than calling it
This required the definition of a new ocamltest variable,
Many thanks for your prompt review, David! (Change entry updated to credit you as a reviewer.) David Allsopp (2019/03/20 02:56 -0700):
dra27 commented on this pull request. I'm not convinced by having a `.c` file which is actually an `ml` file (even with `.ml.c` is nice) - if it can be solved by a `cp` of the original, that'd be nicer!
Well there is no easy way to achieve this currently and we have only one test that would require it, so I am a bit reluctant to spend time on that. One possible way to implement that, though, would be to introduce e.g. `.mlc` files and then ocamltest could be instructed to change their extension to `.ml.c` when it copies / symlinks them to the test build environment. Would that be satisfactory? Could it be postponed or should it really be part of this GPR?
`configure` needs rebuilding
Right! Sorry! I saw your push bud did the update and added it to the main commit.
Having an OCaml file with a `.c` suffix feels really strange, however unlikely it is to be being edited/viewed in future. Could this instead work by leaving it a `.ml` file but copying it into the test directory as a `.c` file?
Either way, there should be a comment somewhere explaining why this file has to have a `.c` extension.
I added the comment.
referenced this pull request
Mar 20, 2019
No, it's all good - I was definitely only meaning to try to
David Allsopp (2019/03/20 04:26 -0700):
No, it's all good - I was definitely only meaning to try to `cp` the file if that was a quick approach which would work,
Well it may, just that I can't think about how to implement it right now but if you have an idea I'd happily integrate it. In any case, I think your suggestion to add a comment improves the situation significantly, so thanks a lot for that.
but as it's not then let's go ahead like this. It's a definite improvement not to be having to second-guess how to call the C preprocessor in `configure.ac` any more.
David Allsopp (2019/03/20 04:30 -0700):
Apropos #2320 (comment), I'm not sure this needs to go in 4.08, does it? It's not fixing an actual bug I think?
Sorry if I am mistaken, but I believe it aovids adding the DIRECT_CPP variable to the installed Makefile.config and in that sense it's useful. Or am I confused, here?
David Allsopp (2019/03/20 15:04 +0000):
@shindere - the change to `CPP` (propagated to `tools/config.ml`) is the bigger and more visible one, so removing the confusion of `DIRECT_CPP` from any release I guess makes sense too.
Yeah that's why I thought it would be good to cherry-pick this on 4.08!