On Thu, 7 Dec 2023 15:52:46 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:

> I'd like to propose a new toolchain for Windows using the clang-cl compiler 
> frontend.
> 
> Clang-cl is available as an optional feature in all Visual Studio editions, 
> including the free-for-OSS-development community edition.
> 
> Clang-cl command line is mostly compatible with cl. However, clang-cl offers 
> a distinct set of diagnostic messages and warnings, which can be used to 
> improve code quality.
> 
> In order to use the clang compiler:
> - install Visual Studio 2022
> - install C++ Clang Compiler 
> (https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170)
> - configure `--with-toolchain-type=clcl`
> - compile as usual.
> 
> Note: at this moment the code does not build; I plan to submit separate 
> patches that fix the build problems separately. For the impatient, [this 
> patch](https://github.com/djelinski/jdk/commit/d67a16244f4e6db8e6e8c59266bebd17827bc2a5)
>  should be enough to compile the JDK, and [this 
> one](https://github.com/djelinski/jdk/commit/1580e7cf54cca61d3ab58891619553994ea26b10)
>  is needed to get tier1 to pass.

Yes, something like that, I guess. That's the best way I see towards modelling 
the change that occurs when cl.exe is replaced with clang-cl.exe. I have not 
really thought about the details, but the "toolchain" concept has been a bit 
loose, basically from day 1. For instance, "clang" might mean "clang on linux" 
or "clang as part of Xcode", and sometimes we really have meant the latter but 
expressed it like it included the former also.

We have had a very simple world to model before, where we have had basically 1 
os <-> 1 toolchain <-> 1 compiler:
* linux - "gnu toolchain" - gcc
* macOS - Xcode - clang
* windows - visual studio/windows sdk - cl

This has allowed us to be sloppy on exactly what we mean. In some cases we have 
started to tighten up the distinction between os and compiler+toolchain, but we 
have not really addressed the situation where the compiler is separate from the 
rest of the toolchain, even though we have had two such cases (originally, gcc 
was used alongside clang on macOS, and currently, clang is supported as an 
alternative to gcc on linux).

So I do not know how we should express it as a command line, or how much change 
is needed in the code base, but yeah, something like that...

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17019#issuecomment-1852147287

Reply via email to