OSDN Git Service

Disable gcc warning about always-true Q_ASSERT check
authorKai Koehne <kai.koehne@nokia.com>
Wed, 17 Aug 2011 07:23:20 +0000 (09:23 +0200)
committerKai Koehne <kai.koehne@nokia.com>
Wed, 17 Aug 2011 11:03:52 +0000 (13:03 +0200)
gcc 4.5.1 warned about the Q_ASSERT in QStringRef::at() being
always false for isCompleteStringLiteral, isCompleteCharLiteral.

Change-Id: Idb20f81f92876eff685166c8deeebd6e151303b1
Reviewed-on: http://codereview.qt.nokia.com/3070
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
src/libs/cplusplus/MatchingText.cpp

index ad87b0c..7be70af 100644 (file)
@@ -55,6 +55,15 @@ static bool shouldOverrideChar(QChar ch)
     }
 }
 
+// disable gcc warning:
+//
+//   qstring.h:1175:39: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
+//
+// caused by Q_ASSERT in QStringRef::at()
+#ifdef Q_CC_GNU
+#    pragma GCC diagnostic ignored "-Wstrict-overflow"
+#endif
+
 static bool isCompleteStringLiteral(const BackwardsScanner &tk, int index)
 {
     const QStringRef text = tk.textRef(index);