diff --git a/src/corelib/global/qassert.cpp b/src/corelib/global/qassert.cpp index 6a29cbfa21c..7c0064ac2ff 100644 --- a/src/corelib/global/qassert.cpp +++ b/src/corelib/global/qassert.cpp @@ -194,36 +194,6 @@ void qBadAlloc() \sa Q_ASSERT(), Q_UNREACHABLE(), Q_LIKELY() */ -/*! - \macro QT_TERMINATE_ON_EXCEPTION(expr) - \relates - \internal - - In general, use of the Q_DECL_NOEXCEPT macro is preferred over - Q_DECL_NOTHROW, because it exhibits well-defined behavior and - supports the more powerful Q_DECL_NOEXCEPT_EXPR variant. However, - use of Q_DECL_NOTHROW has the advantage that Windows builds - benefit on a wide range or compiler versions that do not yet - support the C++11 noexcept feature. - - It may therefore be beneficial to use Q_DECL_NOTHROW and emulate - the C++11 behavior manually with an embedded try/catch. - - Qt provides the QT_TERMINATE_ON_EXCEPTION(expr) macro for this - purpose. It either expands to \c expr (if Qt is compiled without - exception support or the compiler supports C++11 noexcept - semantics) or to - \snippet code/src_corelib_global_qglobal.cpp qterminate - otherwise. - - Since this macro expands to just \c expr if the compiler supports - C++11 noexcept, expecting the compiler to take over responsibility - of calling std::terminate() in that case, it should not be used - outside Q_DECL_NOTHROW functions. - - \sa Q_DECL_NOEXCEPT, Q_DECL_NOTHROW, qTerminate() -*/ - /*! \macro void Q_UNREACHABLE() \relates diff --git a/src/corelib/global/qexceptionhandling.h b/src/corelib/global/qexceptionhandling.h index 76c6185c3ea..7ffd0798f6f 100644 --- a/src/corelib/global/qexceptionhandling.h +++ b/src/corelib/global/qexceptionhandling.h @@ -28,17 +28,11 @@ Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept; # define QT_CATCH(A) else # define QT_THROW(A) qt_noop() # define QT_RETHROW qt_noop() -# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false) #else # define QT_TRY try # define QT_CATCH(A) catch (A) # define QT_THROW(A) throw A # define QT_RETHROW throw -# ifdef Q_COMPILER_NOEXCEPT -# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false) -# else -# define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false) -# endif #endif QT_END_NAMESPACE diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 82b139e4d61..efeec370943 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -834,7 +834,7 @@ void QMessageLogger::fatal(const QLoggingCategory &cat, const char *msg, ...) co va_list ap; va_start(ap, msg); // use variable arg list - QT_TERMINATE_ON_EXCEPTION(qt_message(QtFatalMsg, ctxt, msg, ap)); + qt_message(QtFatalMsg, ctxt, msg, ap); va_end(ap); #ifndef Q_CC_MSVC_ONLY @@ -858,7 +858,7 @@ void QMessageLogger::fatal(QMessageLogger::CategoryFunction catFunc, va_list ap; va_start(ap, msg); // use variable arg list - QT_TERMINATE_ON_EXCEPTION(qt_message(QtFatalMsg, ctxt, msg, ap)); + qt_message(QtFatalMsg, ctxt, msg, ap); va_end(ap); #ifndef Q_CC_MSVC_ONLY @@ -877,7 +877,7 @@ void QMessageLogger::fatal(const char *msg, ...) const noexcept QInternalMessageLogContext ctxt(context); va_list ap; va_start(ap, msg); // use variable arg list - QT_TERMINATE_ON_EXCEPTION(qt_message(QtFatalMsg, ctxt, msg, ap)); + qt_message(QtFatalMsg, ctxt, msg, ap); va_end(ap); #ifndef Q_CC_MSVC_ONLY