Skip to content

Commit a5cdd56

Browse files
committed
Support somewhat recent clang versions on Windows
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] <php#11313 (comment)> [2] <https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#removed-compiler-flags>
1 parent fcd4d39 commit a5cdd56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: win32/build/confutils.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3070,7 +3070,7 @@ function toolset_get_compiler_version()
30703070
var command = 'cmd /c ""' + PHP_CL + '" -v"';
30713071
var full = execute(command + '" 2>&1"');
30723072

3073-
if (full.match(/clang version ([\d\.]+) \((.*)\)/)) {
3073+
if (full.match(/clang version ([\d\.]+)/)) {
30743074
version = RegExp.$1;
30753075
version = version.replace(/\./g, '');
30763076
version = version/100 < 1 ? version*10 : version;
@@ -3324,7 +3324,9 @@ function toolset_setup_common_cflags()
33243324
} else {
33253325
ADD_FLAG('CFLAGS', '-m64');
33263326
}
3327-
ADD_FLAG("CFLAGS", " /fallback ");
3327+
if (CLANGVERS < 1300) {
3328+
ADD_FLAG("CFLAGS", " /fallback ");
3329+
}
33283330
ADD_FLAG("CFLAGS", "-Xclang -fmodules");
33293331

33303332
var vc_ver = probe_binary(PATH_PROG('cl', null));

0 commit comments

Comments
 (0)