Skip to content

Commit fb4d89c

Browse files
committed
allow clang to build tailcall vm on windows, use __preserve_none for Call VM if available
1 parent 6538015 commit fb4d89c

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

Zend/zend_portability.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ char *alloca();
346346
#endif
347347

348348
#ifdef HAVE_PRESERVE_NONE
349-
# define ZEND_PRESERVE_NONE __attribute__((preserve_none))
349+
# if defined(_MSC_VER) && !defined(__clang__)
350+
# define ZEND_PRESERVE_NONE __preserve_none
351+
# else
352+
# define ZEND_PRESERVE_NONE __attribute__((preserve_none))
353+
# endif
350354
#endif
351355

352356

Zend/zend_vm_opcodes.h

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

win32/build/confutils.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3362,6 +3362,10 @@ function toolset_setup_common_cflags()
33623362
}
33633363

33643364
ADD_FLAG("CFLAGS", "/Zc:wchar_t");
3365+
3366+
if (VCVERS >= 1944 && TARGET_ARCH === 'x64') {
3367+
AC_DEFINE('HAVE_PRESERVE_NONE', 1, 'Whether the compiler supports __preserve_none');
3368+
}
33653369
} else if (CLANG_TOOLSET) {
33663370
ADD_FLAG("CFLAGS", "-Wno-deprecated-declarations");
33673371
if (TARGET_ARCH == 'x86') {
@@ -3376,7 +3380,11 @@ function toolset_setup_common_cflags()
33763380

33773381
var vc_ver = probe_binary(PATH_PROG('cl', null));
33783382
ADD_FLAG("CFLAGS"," -fms-compatibility -fms-compatibility-version=" + vc_ver + " -fms-extensions");
3379-
}
3383+
3384+
if (CLANGVERS >= 1900 && (TARGET_ARCH === 'x64' || TARGET_ARCH === 'arm64')) {
3385+
AC_DEFINE('HAVE_PRESERVE_NONE', 1, 'Whether the compiler supports __attribute__((preserve_none))');
3386+
}
3387+
}
33803388

33813389
if (!CLANG_TOOLSET) {
33823390
/* clang uses __builtin_*() instead */

0 commit comments

Comments
 (0)