Testlib: Disable gcc warning about deprecated qInstallMsgHandler
authorKai Koehne <kai.koehne@digia.com>
Wed, 24 Oct 2012 10:25:45 +0000 (12:25 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 1 Nov 2012 08:06:15 +0000 (09:06 +0100)
Fix warning: 'void (* qInstallMsgHandler(QtMsgHandler))(QtMsgType, const char*)' is deprecated (declared at qtestlog.cpp:85) [-Wdeprecated-declarations]

Change-Id: I28d2baf696fdeddec90780edc88574fc368468db
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
src/testlib/qtestlog.cpp

index c56a002..a337a81 100644 (file)
@@ -238,6 +238,12 @@ namespace QTest {
         return false;
     }
 
+// don't warn about qInstallMsgHandler
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
     static void messageHandler(QtMsgType type, const char *msg)
     {
         static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
@@ -287,6 +293,10 @@ namespace QTest {
             break;
         }
     }
+
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
+# pragma GCC diagnostic pop
+#endif
 }
 
 void QTestLog::enterTestFunction(const char* function)