diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-03-23 19:05:17 -0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-19 22:15:16 +0200 |
commit | 5d0da01b54e5b4c94ca8bdcf87cb87b98c3a4fa4 (patch) | |
tree | 8781e92a1bfafe4b72e279def4c0bef17bdbbb37 /src/corelib/global/qlogging.h | |
parent | 886aea1250e43866481a301a77e759ea499c7502 (diff) |
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 <oswald.buddenhagen@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qlogging.h')
-rw-r--r-- | src/corelib/global/qlogging.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index 29313bd582..0860ef71b8 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -113,6 +113,10 @@ public: __attribute__ ((format (printf, 2, 3))) #endif ; + +#ifndef Q_CC_MSVC + Q_NORETURN +#endif void fatal(const char *msg, ...) #if defined(Q_CC_GNU) && !defined(__INSURE__) __attribute__ ((format (printf, 2, 3))) |