diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2021-04-02 01:26:56 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2021-05-23 12:08:42 -0700 |
commit | a24ced747443868b77d015452280ff83493be60a (patch) | |
tree | eeb0fd6432a9cbe00314a7925c3c1ac0bb43eaa7 /src/corelib/tools/qhashfunctions.h | |
parent | 7ac0621ad1a649254e7d6175205e7ea22290b4d0 (diff) |
Mark QHashSeed::globalSeed() noexcept
It is noexcept, except when initializing. When initializing, let's just
use qEnvironmentVariableIntValue (which we should have used anyway),
which avoids the memory allocation and is noexcept. The QRandomGenerator
functions are not marked noexcept, but are mostly so: they can't throw
regular exceptions, but some implementations do call POSIX Thread
Cancellation Points, which may cause forced stack unwinding. That's
unlikely to happen at the moment of the QHash initialization.
This is also mitigated in the next commit.
Change-Id: Id2983978ad544ff79911fffd1671fd16f8d6378d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qhashfunctions.h')
-rw-r--r-- | src/corelib/tools/qhashfunctions.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index 83c9f35f3f..76e781da7a 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -73,7 +73,7 @@ struct QHashSeed constexpr QHashSeed(size_t d = 0) : data(d) {} constexpr operator size_t() const noexcept { return data; } - static Q_CORE_EXPORT QHashSeed globalSeed() Q_DECL_PURE_FUNCTION; + static Q_CORE_EXPORT QHashSeed globalSeed() noexcept Q_DECL_PURE_FUNCTION; static Q_CORE_EXPORT void setDeterministicGlobalSeed(); static Q_CORE_EXPORT void resetRandomGlobalSeed(); private: |