summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-03-17 12:07:44 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-03-29 06:18:49 +0100
commit32692667a625f31aa02e0303f2139c780ae42694 (patch)
treebab74a97f673fd2caee7d1d0b68fac4583fcfb11 /src/corelib/tools
parent9578a3f72fd67011263eac9d306750a2dbef01d1 (diff)
Apply Q_CONSTINIT across the codebase
Still not complete. Just grepping for static and thread_local. Task-number: QTBUG-100486 Change-Id: I90ca14e8db3a95590ecde5f89924cf6fcc9755a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcryptographichash.cpp12
-rw-r--r--src/corelib/tools/qfreelist.cpp2
-rw-r--r--src/corelib/tools/qhash.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 3e6ce016ea..89b5763c5f 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -79,17 +79,17 @@ typedef HashReturn (SHA3Final)(hashState *state, BitSequence *hashval);
#include "../../3rdparty/sha3/KeccakF-1600-opt64.c"
-static SHA3Init * const sha3Init = Init;
-static SHA3Update * const sha3Update = Update;
-static SHA3Final * const sha3Final = Final;
+Q_CONSTINIT static SHA3Init * const sha3Init = Init;
+Q_CONSTINIT static SHA3Update * const sha3Update = Update;
+Q_CONSTINIT static SHA3Final * const sha3Final = Final;
#else // 32 bit optimised fallback
#include "../../3rdparty/sha3/KeccakF-1600-opt32.c"
-static SHA3Init * const sha3Init = Init;
-static SHA3Update * const sha3Update = Update;
-static SHA3Final * const sha3Final = Final;
+Q_CONSTINIT static SHA3Init * const sha3Init = Init;
+Q_CONSTINIT static SHA3Update * const sha3Update = Update;
+Q_CONSTINIT static SHA3Final * const sha3Final = Final;
#endif
diff --git a/src/corelib/tools/qfreelist.cpp b/src/corelib/tools/qfreelist.cpp
index 38ad13a1ee..de34d6de0d 100644
--- a/src/corelib/tools/qfreelist.cpp
+++ b/src/corelib/tools/qfreelist.cpp
@@ -54,7 +54,7 @@ enum {
Size3 = QFreeListDefaultConstants::MaxIndex - Offset3
};
-const int QFreeListDefaultConstants::Sizes[QFreeListDefaultConstants::BlockCount] = {
+Q_CONSTINIT const int QFreeListDefaultConstants::Sizes[QFreeListDefaultConstants::BlockCount] = {
Size0,
Size1,
Size2,
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index eb9c1590d2..24e710c2e5 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -204,6 +204,8 @@ inline HashSeedStorage::StateResult HashSeedStorage::state(int which)
*/
#ifdef Q_DECL_INIT_PRIORITY
Q_DECL_INIT_PRIORITY(05)
+#else
+Q_CONSTINIT
#endif
static HashSeedStorage qt_qhash_seed;