diff options
author | Jędrzej Nowacki <jedrzej.nowacki@digia.com> | 2013-01-10 10:05:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-10 17:58:13 +0100 |
commit | 3b0ed624351441a2d7be45cf9582fd36955ae860 (patch) | |
tree | 49def7351d86d5824a7b6a44982c09d928544f37 /src/corelib/global/qglobal.cpp | |
parent | 7ff47c7bfa5d58a509bb40e1f62777b8d52409ff (diff) |
Protect Q_UNREACHABLE and Q_ASSUME by Q_ASSERT.
Both Q_UNREACHABLE and Q_ASSUME with an invalid condition can produce
really weird side effects and crashes.
Change-Id: I4d808c705ae98388ef5853e6539b70bd5e5ad34b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 3881b166b1..6818b1d64d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1829,6 +1829,8 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() that the current code execution cannot be reached. That is, Q_ASSUME(false) is equivalent to Q_UNREACHABLE(). + In debug builds the condition is enforced by an assert to facilitate debugging. + \note Q_LIKELY() tells the compiler that the expression is likely, but not the only possibility. Q_ASSUME tells the compiler that it is the only possibility. @@ -1863,6 +1865,8 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() By using this macro in impossible conditions, code coverage may be improved as dead code paths may be eliminated. + In debug builds the condition is enforced by an assert to facilitate debugging. + \sa Q_ASSERT(), Q_ASSUME(), qFatal() */ |