summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-03-09 20:48:05 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-03-12 04:23:45 +0000
commit6025c36d014d77091d09271d68154261d1977761 (patch)
treec89d0a32a48eb84c2fb7f55d477531077be55159 /src/corelib
parente5e1e056e8141e97321bde1ed0ce109fe8f19890 (diff)
Make Q_ASSERT_X also check its argument for validity
Commit ebef2ad1360c80ad62de5f4a1c4e7e4051725c1c did it for Q_ASSERT, but I somehow forgot to do it for Q_ASSERT_X. Do it now. This includes the fix from 9a3d7adaad367417aaa2e1ee1f996185a881a4b5 to silence a Clang warning. Change-Id: Iee8cbc07c4434ce9b560ffff13ca066a5b5ab5d4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qcompilerdetection.h1
-rw-r--r--src/corelib/global/qglobal.h2
2 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 0ca67df1e2..1774378c06 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1164,7 +1164,6 @@
const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\
- Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\
} while (0)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index ddba460b06..27a3bf7c3d 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -681,7 +681,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
#if !defined(Q_ASSERT_X)
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
-# define Q_ASSERT_X(cond, where, what) qt_noop()
+# define Q_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
# else
# define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
# endif