Skip to content

Commit d10bd81

Browse files
authored
pythongh-133261: Use __builtin_frame_address() on GCC 9 and older (python#133269)
GCC 9 and older don't have __has_builtin(), but have __builtin_frame_address() function.
1 parent e5e51bd commit d10bd81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Include/internal/pycore_pystate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,15 @@ _Py_AssertHoldsTstateFunc(const char *func)
300300
#define _Py_AssertHoldsTstate()
301301
#endif
302302

303-
#if !_Py__has_builtin(__builtin_frame_address) && !defined(_MSC_VER)
303+
#if !_Py__has_builtin(__builtin_frame_address) && !defined(__GNUC__) && !defined(_MSC_VER)
304304
static uintptr_t return_pointer_as_int(char* p) {
305305
return (uintptr_t)p;
306306
}
307307
#endif
308308

309309
static inline uintptr_t
310310
_Py_get_machine_stack_pointer(void) {
311-
#if _Py__has_builtin(__builtin_frame_address)
311+
#if _Py__has_builtin(__builtin_frame_address) || defined(__GNUC__)
312312
return (uintptr_t)__builtin_frame_address(0);
313313
#elif defined(_MSC_VER)
314314
return (uintptr_t)_AddressOfReturnAddress();

0 commit comments

Comments
 (0)