From 5d0da01b54e5b4c94ca8bdcf87cb87b98c3a4fa4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 23 Mar 2012 19:05:17 -0300 Subject: Mark qt_assert and qFatal as non-returning functions (excpt. MSVC) This allows the compiler to optimise the code a bit better: since they don't return, it can assume in the code after the Q_ASSERT that the condition was true. MSVC is the exception: with MSVC, we have the CrtDbgReport dialog, which allows the developer to continue execution, inside the debugger. Therefore, we can't mark any of those functions as non-returning because they can, after all, return. Unfortunately, the Q_ASSERT usually expands to no code in release mode, so the improvement in code generation happens in debug mode only... Change-Id: I4d542d6853cd51c71ffab1d563ed64ef7c419115 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib/global/qglobal.h') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 0828a3dac3..f3c3b7896d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -896,6 +896,10 @@ inline void qUnused(T &x) { (void)x; } class QString; Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); + +#ifndef Q_CC_MSVC +Q_NORETURN +#endif Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); #if !defined(Q_ASSERT) @@ -910,6 +914,9 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); #define QT_NO_PAINT_DEBUG #endif +#ifndef Q_CC_MSVC +Q_NORETURN +#endif Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line); #if !defined(Q_ASSERT_X) -- cgit v1.2.3