diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-17 14:53:14 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-05-18 02:09:02 +0200 |
commit | 8f7873272ac9e5c5f1a83a5204afb512843cf8d8 (patch) | |
tree | bf6df48d3d6b3bdfaac6d906814d81d07035f694 /src/corelib/global/qglobal.cpp | |
parent | 42b8bbbef097626d2c7fc30097f7a5f904036860 (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
Pick-to: 6.1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
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 8fb835286a..9f18e9a894 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -60,8 +60,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) @@ -3289,7 +3291,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 } /* |