diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c046b8078de..2ec14a6a467 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -59,10 +59,8 @@ #include #include -#ifndef QT_NO_EXCEPTIONS -# include -# include -#endif +#include +#include #include #if defined(Q_CC_MSVC) @@ -3098,14 +3096,9 @@ void qt_check_pointer(const char *n, int l) noexcept */ void qBadAlloc() { -#ifndef QT_NO_EXCEPTIONS QT_THROW(std::bad_alloc()); -#else - std::terminate(); -#endif } -#ifndef QT_NO_EXCEPTIONS /* \internal Allows you to call std::terminate() without including . @@ -3115,7 +3108,6 @@ Q_NORETURN void qTerminate() noexcept { std::terminate(); } -#endif /* The Q_ASSERT macro calls this function when the test fails. diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 47ffe170349..07385db26be 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -834,6 +834,7 @@ inline void qt_noop(void) {} # endif #endif +Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept; #ifdef QT_NO_EXCEPTIONS # define QT_TRY if (true) # define QT_CATCH(A) else @@ -845,7 +846,6 @@ inline void qt_noop(void) {} # define QT_CATCH(A) catch (A) # define QT_THROW(A) throw A # define QT_RETHROW throw -Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept; # ifdef Q_COMPILER_NOEXCEPT # define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false) # else