android: don't unconditionally use execinfo.h
authorRobin Burchell <robin.burchell@collabora.co.uk>
Mon, 2 Jul 2012 09:19:56 +0000 (11:19 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 2 Jul 2012 17:08:28 +0000 (19:08 +0200)
android (a superset or subset, depending on your POV) of Linux doesn't seem to
have execinfo.h, so disable it there.

also simplify the conditional a little so we don't have to alter this all over
the place if the platform support changes in the future.

Change-Id: I937b04f363dfff2b10e1696f11e67d4ba55b3b06
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/quick/scenegraph/util/qsgtexture.cpp

index 816b041..c3f15cc 100644 (file)
 #include <private/qqmlprofilerservice_p.h>
 #include <private/qqmlglobal_p.h>
 
-#if !defined(QT_NO_DEBUG) && (defined(Q_OS_LINUX) || defined(Q_OS_MAC))
+#if defined(Q_OS_LINUX) && !defined(Q_OS_LINUX_ANDROID)
+#define CAN_BACKTRACE_EXECINFO
+#endif
+
+#if defined(Q_OS_MAC)
+#define CAN_BACKTRACE_EXECINFO
+#endif
+
+#if defined(QT_NO_DEBUG)
+#undef CAN_BACKTRACE_EXECINFO
+#endif
+
+#if defined(CAN_BACKTRACE_EXECINFO)
 #include <execinfo.h>
 #include <QHash>
 #endif
@@ -94,7 +106,7 @@ inline static void qt_debug_print_texture_count()
     qDebug("Number of leaked textures: %i", qt_debug_texture_count);
     qt_debug_texture_count = -1;
 
-#if defined(Q_OS_LINUX) || defined (Q_OS_MAC)
+#if defined(CAN_BACKTRACE_EXECINFO)
     if (qmlDebugLeakBacktrace()) {
         while (!qt_debug_allocated_textures.isEmpty()) {
             QHash<QSGTexture*, SGTextureTraceItem*>::Iterator it = qt_debug_allocated_textures.begin();
@@ -124,7 +136,7 @@ inline static void qt_debug_print_texture_count()
 
 inline static void qt_debug_add_texture(QSGTexture* texture)
 {
-#if defined(Q_OS_LINUX) || defined (Q_OS_MAC)
+#if defined(CAN_BACKTRACE_EXECINFO)
     if (qmlDebugLeakBacktrace()) {
         SGTextureTraceItem* item = new SGTextureTraceItem;
         item->backTraceSize = backtrace(item->backTrace, BACKTRACE_SIZE);
@@ -145,7 +157,7 @@ inline static void qt_debug_add_texture(QSGTexture* texture)
 
 static void qt_debug_remove_texture(QSGTexture* texture)
 {
-#if defined(Q_OS_LINUX) || defined (Q_OS_MAC)
+#if defined(CAN_BACKTRACE_EXECINFO)
     if (qmlDebugLeakBacktrace()) {
         SGTextureTraceItem* item = qt_debug_allocated_textures.value(texture, 0);
         if (item) {