diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-17 14:53:14 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-18 02:16:31 +0000 |
commit | 37ff9b02e515f63b33f895ab911209b4a89faf2b (patch) | |
tree | 3896d5b27fcb2c394884395cb0d644ab572385f4 /src/corelib/global/qglobal.cpp | |
parent | ad12c3c40b07079d875f48027eef0786acef7de0 (diff) |
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 <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8f7873272ac9e5c5f1a83a5204afb512843cf8d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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 <stdarg.h> #include <string.h> -#include <string> -#include <exception> +#include <exception> // For std::terminate +#ifndef QT_NO_EXCEPTIONS +#include <new> // For std::bad_alloc +#endif #include <errno.h> #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 } /* |