Update Fix more generic for platforms that do not have execinfo.h

Improve multiplatform code with __has_include.
This commit is contained in:
simbit18 2023-10-14 14:17:07 +02:00 committed by Xiang Xiao
parent 73ca090ab9
commit 2be45a3391

View File

@ -40,6 +40,12 @@
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#endif #endif
#if defined __has_include
# if __has_include(<execinfo.h>)
# define SIM_GLIBC_PLATFORM 1
# endif
#endif
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
@ -90,10 +96,10 @@ void host_abort(int status)
int host_backtrace(void** array, int size) int host_backtrace(void** array, int size)
{ {
#ifdef CONFIG_WINDOWS_CYGWIN #ifdef SIM_GLIBC_PLATFORM
return 0;
#else
return host_uninterruptible(backtrace, array, size); return host_uninterruptible(backtrace, array, size);
#else
return 0;
#endif #endif
} }