summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qlogging_p.h')
-rw-r--r--src/corelib/global/qlogging_p.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/corelib/global/qlogging_p.h b/src/corelib/global/qlogging_p.h
index 9df53333cb..bc331c80c0 100644
--- a/src/corelib/global/qlogging_p.h
+++ b/src/corelib/global/qlogging_p.h
@@ -18,7 +18,20 @@
#include <QtCore/private/qglobal_p.h>
#include "qlogging.h"
#include "qloggingcategory.h"
-#include "qvarlengtharray.h"
+
+#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(regularexpression)
+# if __has_include(<cxxabi.h>) && QT_CONFIG(backtrace)
+# include <optional>
+# include "qvarlengtharray.h"
+# define QLOGGING_USE_EXECINFO_BACKTRACE
+# define QLOGGING_HAVE_BACKTRACE
+# elif QT_CONFIG(cxx23_stacktrace)
+# include <optional>
+# include <stacktrace>
+# define QLOGGING_USE_STD_BACKTRACE
+# define QLOGGING_HAVE_BACKTRACE
+# endif
+#endif // QT_BOOTSTRAPPED
QT_BEGIN_NAMESPACE
@@ -32,7 +45,15 @@ class QInternalMessageLogContext : public QMessageLogContext
{
public:
static constexpr int DefaultBacktraceDepth = 32;
+
+#if defined(QLOGGING_USE_EXECINFO_BACKTRACE)
using BacktraceStorage = QVarLengthArray<void *, DefaultBacktraceDepth>;
+#elif defined(QLOGGING_USE_STD_BACKTRACE)
+ using BacktraceStorage = std::stacktrace;
+#else
+ using BacktraceStorage = bool; // dummy
+#endif
+
std::optional<BacktraceStorage> backtrace;
Q_ALWAYS_INLINE QInternalMessageLogContext(const QMessageLogContext &logContext)