mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-133261: Use __builtin_frame_address() on GCC 9 and older (#133269)
GCC 9 and older don't have __has_builtin(), but have __builtin_frame_address() function.
This commit is contained in:
parent
e5e51bd7f7
commit
d10bd81b45
1 changed files with 2 additions and 2 deletions
|
@ -300,7 +300,7 @@ _Py_AssertHoldsTstateFunc(const char *func)
|
|||
#define _Py_AssertHoldsTstate()
|
||||
#endif
|
||||
|
||||
#if !_Py__has_builtin(__builtin_frame_address) && !defined(_MSC_VER)
|
||||
#if !_Py__has_builtin(__builtin_frame_address) && !defined(__GNUC__) && !defined(_MSC_VER)
|
||||
static uintptr_t return_pointer_as_int(char* p) {
|
||||
return (uintptr_t)p;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ static uintptr_t return_pointer_as_int(char* p) {
|
|||
|
||||
static inline uintptr_t
|
||||
_Py_get_machine_stack_pointer(void) {
|
||||
#if _Py__has_builtin(__builtin_frame_address)
|
||||
#if _Py__has_builtin(__builtin_frame_address) || defined(__GNUC__)
|
||||
return (uintptr_t)__builtin_frame_address(0);
|
||||
#elif defined(_MSC_VER)
|
||||
return (uintptr_t)_AddressOfReturnAddress();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue