[posix] use __GLIBC__ instead of __linux__ in backtrace (#8373)

he `execinfo.h` is a glibc specific header, and the glibc doesn't
exist under openwrt. It causes the compile errors under openwrt in
ot-br-posix. This commit uses __GLIBC__ instead of __linux__ to avoid
the compile errors when the OS doesn't contain the glibc.
This commit is contained in:
Zhanglong Xia
2022-11-07 22:23:24 +01:00
committed by GitHub
parent 6b03d55cc4
commit 91fa1f455a
+3 -4
View File
@@ -44,8 +44,7 @@
#include "common/logging.hpp"
#if OPENTHREAD_POSIX_CONFIG_BACKTRACE_ENABLE
#if defined(__linux__) && !OPENTHREAD_ENABLE_ANDROID_NDK
#if OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE || defined(__GLIBC__)
#if OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE
#include <log/log.h>
#include <utils/CallStack.h>
@@ -162,9 +161,9 @@ void platformBacktraceInit(void)
sigaction(SIGTRAP, &sigact, (struct sigaction *)nullptr);
sigaction(SIGFPE, &sigact, (struct sigaction *)nullptr);
}
#else // defined(__linux__) && !OPENTHREAD_ENABLE_ANDROID_NDK
#else // OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE || defined(__GLIBC__)
void platformBacktraceInit(void)
{
}
#endif // defined(__linux__) && !OPENTHREAD_ENABLE_ANDROID_NDK
#endif // OPENTHREAD_POSIX_CONFIG_ANDROID_ENABLE || defined(__GLIBC__)
#endif // OPENTHREAD_POSIX_CONFIG_BACKTRACE_ENABLE