Make init-compiler.sh fall back to and work with generic compiler #14756
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a version-specific compiler (eg, clang-17) is passed to the script, it works as before. And like before, if a generic compiler (eg clang) is passed to the script, it prefers to find and use the few specific/known/tested versions of compilers (eg, clang means use clang-18 if possible). However, unlike before, if none of those specific known versions are found, it correctly falls back to the generic compiler binary (eg clang) in $PATH.
The script was actually supposed to do all this already, but it seems to have been broken when warning messages were added. These warning messages were parsed by msbuild. Msbuild would see the warning messages and fail the build.
With a generic compiler, this script now also invokes it via $compiler -dumpversion (which works on both clang and gcc) to find the version for various (existing) version checks. The compiler was already being invoked to check if -fuse-ld=lld is supported.
Fixes: #14632