summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-08-03 10:38:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-09 03:26:17 +0200
commitc856e37c5fddec64d8635f3dae57b9cbea1aada4 (patch)
tree08233d5e1c6ee74811a1ae9e644d8b317c80818b /src/corelib/global/qlogging.h
parent7ef395224ea42a9a8d3469194d960077d7ff21eb (diff)
Logging: mark qt_assert()/qt_assert_x()/qFatal() as nothrow
These functions are not supposed to return, not even by exception. qt_message() _can_ throw, but we're fine with the compiler calling std::terminate() then, since the backtrace will still include the assertion location. This behaviour is ensured by a new macro, QT_TERMINATE_ON_EXCEPTION, which expands to something like try { expr; } catch(...) { std::terminate(); } if the compiler doesn't support Q_DECL_NOEXCEPT (but maybe Q_DECL_NOTHROW), and to something like just expr; otherwise (including in the QT_NO_EXCEPTION case). The real macro preserves scopes in all cases, and aims to work even if <exception> isn't included in the TU it's used in, so is a little bit more complex than that. Change-Id: Ie6a2b7776e6aa77e57bd9aea6e184e5fa1cec81c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qlogging.h')
-rw-r--r--src/corelib/global/qlogging.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index 618c0cd0ea..f1f9643753 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -117,7 +117,7 @@ public:
#ifndef Q_CC_MSVC
Q_NORETURN
#endif
- void fatal(const char *msg, ...)
+ void fatal(const char *msg, ...) Q_DECL_NOTHROW
#if defined(Q_CC_GNU) && !defined(__INSURE__)
__attribute__ ((format (printf, 2, 3)))
#endif