From ce53dab2722611c2e87d680b9be43e187d82219f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 19 Jan 2025 14:43:45 +0100 Subject: [PATCH] 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). --- Zend/zend_call_stack.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Zend/zend_call_stack.h b/Zend/zend_call_stack.h index c8bc756426b..fee528c150f 100644 --- a/Zend/zend_call_stack.h +++ b/Zend/zend_call_stack.h @@ -25,6 +25,10 @@ # include #endif +#ifdef _MSC_VER +#include +#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);