summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-02-18 11:13:25 -0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-16 19:04:02 +0000
commit7d65d82c257195d18822f7f42f2318512c3f58de (patch)
treeb464add9de1703ead7e9720e5aa2f9267f99a092
parent69625e02ed5394f2f9ef1f7f0e44787123ef7f09 (diff)
Logging: rejiggle the way we detect the availability of backtrace() API
We had proper CMake tests for all we needed, so we can drop the old detection we were forced to use way back when. Said test (CMake's own FindBacktrace.cmake) even found QNX's offering, which we reported as "yes" in our configure output, but never actually used because it was a different API. Now we'll report "no" for QNX. Change-Id: Ic15405335d804bdea761fffd16d4f73cfe4cf38a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 6358bc9331a961b882173367e9483f4eb4ca4783) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/CMakeLists.txt2
-rw-r--r--src/corelib/configure.cmake4
-rw-r--r--src/corelib/global/qlogging.cpp21
3 files changed, 11 insertions, 16 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index c83ec2640b..e722be1851 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -697,6 +697,8 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_commandlineparser
)
qt_internal_extend_target(Core CONDITION QT_FEATURE_backtrace
+ DEFINES
+ BACKTRACE_HEADER="${Backtrace_HEADER}"
LIBRARIES
WrapBacktrace::WrapBacktrace
)
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index aa51aad275..f386a62985 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -14,7 +14,9 @@ set_property(CACHE INPUT_libb2 PROPERTY STRINGS undefined no qt system)
#### Libraries
-if((UNIX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+if((UNIX AND NOT QNX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
+ # QNX's libbacktrace has an API wholly different from all the other Unix
+ # offerings
qt_find_package(WrapBacktrace PROVIDED_TARGETS WrapBacktrace::WrapBacktrace MODULE_NAME core QMAKE_LIB backtrace)
endif()
qt_find_package(WrapDoubleConversion PROVIDED_TARGETS WrapDoubleConversion::WrapDoubleConversion MODULE_NAME core QMAKE_LIB doubleconversion)
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 24f7d9342a..ece8216ed6 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -2,7 +2,7 @@
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
-** Copyright (C) 2018 Intel Corporation.
+** Copyright (C) 2022 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -107,14 +107,11 @@ extern char *__progname;
#endif
#ifndef QT_BOOTSTRAPPED
-#if QT_CONFIG(regularexpression)
-# ifdef __UCLIBC__
-# if __UCLIBC_HAS_BACKTRACE__
-# define QLOGGING_HAVE_BACKTRACE
-# endif
-# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include(<cxxabi.h>) && __has_include(<execinfo.h>))
-# define QLOGGING_HAVE_BACKTRACE
-# endif
+#if __has_include(<cxxabi.h>) && QT_CONFIG(backtrace) && QT_CONFIG(regularexpression)
+# include <qregularexpression.h>
+# include BACKTRACE_HEADER
+# include <cxxabi.h>
+# define QLOGGING_HAVE_BACKTRACE
#endif
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include(<sys/syscall.h>))
@@ -152,12 +149,6 @@ static QT_PREPEND_NAMESPACE(qint64) qt_gettid()
return qintptr(QThread::currentThreadId());
}
#endif
-
-#ifdef QLOGGING_HAVE_BACKTRACE
-# include <qregularexpression.h>
-# include <cxxabi.h>
-# include <execinfo.h>
-#endif
#endif // !QT_BOOTSTRAPPED
#include <cstdlib>