Make qTerminate available when QT_NO_EXCEPTIONS flag is set
It seems that QtCore could only be compiled with exceptions enabled. Therefore it doesn't make sense to keep conditonal code under QT_NO_EXCEPTIONS in qglobal.cpp. qTerminate may be called whether exceptions are enabled or not. Pick-to: 6.1 Fixes: QTBUG-93739 Change-Id: Ie49c10f27cfa75360f018e8638603e6a1791450e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0533695ddd
commit
282b724808
@ -60,10 +60,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
# include <string>
|
||||
# include <exception>
|
||||
#endif
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
#include <errno.h>
|
||||
#if defined(Q_CC_MSVC)
|
||||
@ -3291,14 +3289,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 <exception>.
|
||||
@ -3308,7 +3301,6 @@ Q_NORETURN void qTerminate() noexcept
|
||||
{
|
||||
std::terminate();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
The Q_ASSERT macro calls this function when the test fails.
|
||||
|
@ -935,6 +935,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
|
||||
@ -946,7 +947,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user