You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/10/14 17:34:23 UTC
[nuttx] branch master updated: Update Fix more generic for platforms that do not have execinfo.h
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 2be45a3391 Update Fix more generic for platforms that do not have execinfo.h
2be45a3391 is described below
commit 2be45a33915edbfc131d02fe908277cd0b95d1b3
Author: simbit18 <10...@users.noreply.github.com>
AuthorDate: Sat Oct 14 14:17:07 2023 +0200
Update Fix more generic for platforms that do not have execinfo.h
Improve multiplatform code with __has_include.
---
arch/sim/src/sim/posix/sim_hostmisc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/sim/src/sim/posix/sim_hostmisc.c b/arch/sim/src/sim/posix/sim_hostmisc.c
index a1856b8d47..a8b3f2584e 100644
--- a/arch/sim/src/sim/posix/sim_hostmisc.c
+++ b/arch/sim/src/sim/posix/sim_hostmisc.c
@@ -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
****************************************************************************/
@@ -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
}