From 91fa1f455a1d368dff9d712b38561bd08688e1f5 Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Tue, 8 Nov 2022 05:23:24 +0800 Subject: [PATCH] [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. --- src/posix/platform/backtrace.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/posix/platform/backtrace.cpp b/src/posix/platform/backtrace.cpp index 45e3b5665..02cb07d62 100644 --- a/src/posix/platform/backtrace.cpp +++ b/src/posix/platform/backtrace.cpp @@ -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 #include @@ -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