1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Support somewhat recent clang versions on Windows (GH-15324)

Prior to clang 10.0.0, `clang-cl -v` apparently always appended some
fine grained version information in parentheses[1]; this is no longer
the case, so the build fails early because the compiler version could
not be detected.  Since we never used this fine grained version info,
we no longer check for it.

As of clang 13.0.0, the `/fallback` command option has been removed[2],
so we only set the flag for older clang versions.

[1] <https://github.com/php/php-src/pull/11313#discussion_r1712097627>
[2] <https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#removed-compiler-flags>
This commit is contained in:
Christoph M. Becker
2024-08-10 20:57:53 +02:00
committed by GitHub
parent 8d7365b6f0
commit 8740fdf1f6

View File

@@ -3070,7 +3070,7 @@ function toolset_get_compiler_version()
var command = 'cmd /c ""' + PHP_CL + '" -v"';
var full = execute(command + '" 2>&1"');
if (full.match(/clang version ([\d\.]+) \((.*)\)/)) {
if (full.match(/clang version ([\d\.]+)/)) {
version = RegExp.$1;
version = version.replace(/\./g, '');
version = version/100 < 1 ? version*10 : version;
@@ -3324,7 +3324,9 @@ function toolset_setup_common_cflags()
} else {
ADD_FLAG('CFLAGS', '-m64');
}
ADD_FLAG("CFLAGS", " /fallback ");
if (CLANGVERS < 1300) {
ADD_FLAG("CFLAGS", " /fallback ");
}
ADD_FLAG("CFLAGS", "-Xclang -fmodules");
var vc_ver = probe_binary(PATH_PROG('cl', null));