Skip to content

Commit ce53dab

Browse files
committed
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).
1 parent 6bd2b8d commit ce53dab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Zend/zend_call_stack.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
# include <pthread.h>
2626
#endif
2727

28+
#ifdef _MSC_VER
29+
#include <intrin.h>
30+
#endif
31+
2832
#ifdef ZEND_CHECK_STACK_LIMIT
2933

3034
typedef struct _zend_call_stack {
@@ -38,7 +42,7 @@ ZEND_API bool zend_call_stack_get(zend_call_stack *stack);
3842

3943
/** Returns an approximation of the current stack position */
4044
static zend_always_inline void *zend_call_stack_position(void) {
41-
#ifdef ZEND_WIN32
45+
#ifdef _MSC_VER
4246
return _AddressOfReturnAddress();
4347
#elif defined(PHP_HAVE_BUILTIN_FRAME_ADDRESS)
4448
return __builtin_frame_address(0);

0 commit comments

Comments
 (0)