add dmd/hostcompiler.d
This is to encapsulate host compiler differences. The logic is spread across several files, and should be encapsulated into one file.
This is not about the host operating system, the target operating system, or the target machine. It's only about the host compiler.
Putting abstracting this into one file makes the rest of the compiler more generic, and makes things easier to maintain.
This PR is just a first step towards implementing this.
Every effort should be made to minimize the number of imports this file does.
Thanks for your pull request, @WalterBright!
Bugzilla references
Your PR doesn't reference any Bugzilla issue.
If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "master + dmd#21431"
There's already a compiler module for this.
@ibuclaw I didn't know about that module. But I don't see any version statements in it.
When I added it, I envisioned that each compiler would have its own version of it, rather than have it as a shared/common module between us.
For example, gdc implements dmd.compiler in C++. The D module is just the declarations.
https://github.com/gcc-mirror/gcc/blob/master/gcc/d/dmd/compiler.d
Ready to merge
What about putting these in the dmd.compiler module?
I don't see the need for version statements, as gdc/ldc can just provide their own implementations locally.
I don't see any common purpose with the code that's in dmd.compiler. I don't understand what the code in it does.
Anyhow, there are several ways to do this, such as using interfaces, versions, pointers to functions, etc. Which one is best, I don't know at the moment. What I do know is the compiler is more tractable without version statements scattered through it. I'm open to a future scheme for this, but for the moment this PR will abstract a significant pile of versions out of the common compiler code into a separate module, which is a significant improvement.
ping @ibuclaw
I suspect gdc opturls will still be broken by this, but as these are all enums, it can be fixed again by using ctfe concatenation of the string format instead of runtime %s.
OK, but this introduced module will be deleted after merge as everything here will just be folded into the dmd.compiler module.
Will leave it to @kinke to sign off the remaining ldc bits.
Why aren't we moving forward with this?
It looks like the extensive refactoring has completely scrambled and trashed this PR. I'll have to write a new one.