From 37ff9b02e515f63b33f895ab911209b4a89faf2b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 17 May 2021 14:53:14 +0200 Subject: qglobal.cpp: build under QT_NO_EXCEPTIONS The boostrap library is built with exceptions disabled, and its sources include qglobal.cpp. Therefore, the file must work when built w/o exceptions. Amend/partially revert 282b724808ea4524ed09b9f0183055fdffc3c38a with the necessary fixes. Driveby, cleanup an unnecessary QT_THROW (just throw, if we do have exceptions). Change-Id: I370c295c21edd3d81a9fa670e60909b29d1c68aa Reviewed-by: Thiago Macieira Reviewed-by: Alexey Edelev (cherry picked from commit 8f7873272ac9e5c5f1a83a5204afb512843cf8d8) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qglobal.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/corelib/global/qglobal.cpp') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 2ec14a6a46..0addd47729 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -59,8 +59,10 @@ #include #include -#include -#include +#include // For std::terminate +#ifndef QT_NO_EXCEPTIONS +#include // For std::bad_alloc +#endif #include #if defined(Q_CC_MSVC) @@ -3096,7 +3098,11 @@ void qt_check_pointer(const char *n, int l) noexcept */ void qBadAlloc() { - QT_THROW(std::bad_alloc()); +#ifndef QT_NO_EXCEPTIONS + throw std::bad_alloc(); +#else + std::terminate(); +#endif } /* -- cgit v1.2.3