Skip to content

Commit

Permalink
Update Fix more generic for platforms that do not have execinfo.h
Browse files Browse the repository at this point in the history
Improve multiplatform code with __has_include.
  • Loading branch information
simbit18 authored and xiaoxiang781216 committed Oct 14, 2023
1 parent 73ca090 commit 2be45a3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions arch/sim/src/sim/posix/sim_hostmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
#include <mach-o/dyld.h>
#endif

#if defined __has_include
# if __has_include(<execinfo.h>)
# define SIM_GLIBC_PLATFORM 1
# endif
#endif

/****************************************************************************
* Public Function Prototypes
****************************************************************************/
Expand Down Expand Up @@ -90,10 +96,10 @@ void host_abort(int status)

int host_backtrace(void** array, int size)
{
#ifdef CONFIG_WINDOWS_CYGWIN
return 0;
#else
#ifdef SIM_GLIBC_PLATFORM
return host_uninterruptible(backtrace, array, size);
#else
return 0;
#endif
}

Expand Down

0 comments on commit 2be45a3

Please sign in to comment.