Fix Clang builds regarding undefined function call

While MSVC is apparently fine using `_AddressOfReturnAddress()` without
including intrin.h, Clang complains that the function is undefined.  So
we include the header, if `_MSC_VER` is defined, what is the case for
MSVC and clang-cl, but not for some other compilers on Windows (e.g.
GCC).
This commit is contained in:
Christoph M. Becker 2025-01-19 14:43:45 +01:00
parent 6bd2b8dfa5
commit ce53dab272

View file

@ -25,6 +25,10 @@
# include <pthread.h>
#endif
#ifdef _MSC_VER
#include <intrin.h>
#endif
#ifdef ZEND_CHECK_STACK_LIMIT
typedef struct _zend_call_stack {
@ -38,7 +42,7 @@ ZEND_API bool zend_call_stack_get(zend_call_stack *stack);
/** Returns an approximation of the current stack position */
static zend_always_inline void *zend_call_stack_position(void) {
#ifdef ZEND_WIN32
#ifdef _MSC_VER
return _AddressOfReturnAddress();
#elif defined(PHP_HAVE_BUILTIN_FRAME_ADDRESS)
return __builtin_frame_address(0);