From 9e214cbcdd138d2363b836c005450d27c0191f74 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 Feb 2024 20:13:28 -0800 Subject: [PATCH] Bootstrap: remove QRandomGenerator The bootstrapped tools really mustn't produce random output (they must always be reproducible exactly). Therefore, ensure we don't need this file. Change-Id: I01ec3c774d9943adb903fffd17b7eb94dbd4be89 Reviewed-by: Alexey Edelev Reviewed-by: Ahmad Samir Reviewed-by: Joerg Bornemann --- src/corelib/plugin/quuid.cpp | 4 ++-- src/corelib/tools/qhash.cpp | 2 ++ src/tools/bootstrap/CMakeLists.txt | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 63aef7fc676..9c7216c3c5b 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -992,7 +992,7 @@ QUuid QUuid::createUuid() return result; } -#else // Q_OS_WIN +#elif !defined(QT_BOOTSTRAPPED) QUuid QUuid::createUuid() { @@ -1006,7 +1006,7 @@ QUuid QUuid::createUuid() return result; } -#endif // !Q_OS_WIN +#endif // !Q_OS_WIN && !QT_BOOTSTRAPPED /*! \fn bool QUuid::operator==(const GUID &guid) const diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index af393b92352..4e0c07186de 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -85,6 +85,7 @@ struct HashSeedStorage void resetSeed() { +#ifndef QT_BOOTSTRAPPED if (state().state < AlreadyInitialized) return; @@ -92,6 +93,7 @@ struct HashSeedStorage QRandomGenerator *generator = QRandomGenerator::system(); seeds[0].storeRelaxed(sizeof(size_t) > sizeof(quint32) ? generator->generate64() : generator->generate()); +#endif } void clearSeed() diff --git a/src/tools/bootstrap/CMakeLists.txt b/src/tools/bootstrap/CMakeLists.txt index 673c1f70bfb..3f4d993fbf8 100644 --- a/src/tools/bootstrap/CMakeLists.txt +++ b/src/tools/bootstrap/CMakeLists.txt @@ -20,7 +20,6 @@ qt_internal_extend_target(Bootstrap ../../corelib/global/qmalloc.cpp ../../corelib/global/qnumeric.cpp ../../corelib/global/qoperatingsystemversion.cpp - ../../corelib/global/qrandom.cpp ../../corelib/global/qtenvironmentvariables.cpp ../../corelib/io/qabstractfileengine.cpp ../../corelib/io/qbuffer.cpp