Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions win32/build/confutils.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -3067,7 +3067,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\.]+)(?: \((.*)\))?/)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this group at all? We're not actually using it.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, probably not. I don't know what this was capturing, it doesn't match anything in modern versions of clang-cl.

@cmb69cmb69Aug 9, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang 9.0.0 says:

clang version 9.0.0 (tags/RELEASE_900/final)`

So the \((.*)\) was likely meant to catch the info in parens, although it is indeed not used, and as such could be completely removed. And actually, even the version is not used (well, it could be used in config.w32, but likely almost anybody assumes that these are for VS).

For what it's worth, I've just managed to do a successful minimal build (--with-toolset=clang --disable-all --enable-cli) of PHP-8.0 with clang 9.0.0, but PHP-8.1 failed; I'll check what a recent version of clang produces.

version = RegExp.$1;
version = version.replace(/\./g, '');
version = version/100 < 1 ? version*10 : version;
Expand DownExpand Up@@ -3188,11 +3188,12 @@ function toolset_setup_codegen_arch()
function toolset_setup_linker()
{
var lnk = false;
var what = null;
if (VS_TOOLSET) {
lnk = PATH_PROG('link', null);
} else if (CLANG_TOOLSET) {
//return PATH_PROG('lld', WshShell.Environment("Process").Item("PATH"), "LINK");
lnk = PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
lnk = PATH_PROG('lld-link', WshShell.Environment("Process").Item("PATH"), "LINK");
what = "longversion";
} else if (ICC_TOOLSET) {
lnk = PATH_PROG('xilink', WshShell.Environment("Process").Item("PATH"), "LINK");
}
Expand All@@ -3201,7 +3202,7 @@ function toolset_setup_linker()
ERROR("Unsupported toolset");
}

var ver = probe_binary(lnk);
var ver = probe_binary(lnk, what);

var major = ver.substr(0, 2);
var minor = ver.substr(3, 2);
Expand DownExpand Up@@ -3675,7 +3676,7 @@ function get_clang_lib_dir()
var ret = null;
var ver = null;

if (COMPILER_NAME_LONG.match(/clang version ([\d\.]+) \((.*)\)/)) {
if (COMPILER_NAME_LONG.match(/clang version ([\d\.]+)(?: \((.*)\))?/)) {
ver = RegExp.$1;
} else {
ERROR("Failed to determine clang lib path");
Expand DownExpand Up@@ -3708,7 +3709,7 @@ function add_asan_opts(cflags_name, libs_name, ldflags_name)

var ver = null;

if (COMPILER_NAME_LONG.match(/clang version ([\d\.]+) \((.*)\)/)) {
if (COMPILER_NAME_LONG.match(/clang version ([\d\.]+)(?: \((.*)\))?/)) {
ver = RegExp.$1;
} else {
ERROR("Failed to determine clang lib path");
Expand Down