From a699014fe55028e8e5f5d6ea254438a6d2e3f9c8 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Fri, 10 Jan 2025 15:25:26 +0100 Subject: [PATCH] QThreadStorage: move includes to the top The qthreadstorage.h header contains two implementations controlled by the QT_CONFIG(thread) definition. Commit 8553ffd8d147ecf6a713d12a360027b477dd59c8 changed the positions of the namespace macros in the header, but didn't consider the fact that we now include std and Qt headers inside QT_NAMESPACE in the !QT_CONFIG(thread) case. Fix it by moving all the includes to the top, and wrapping them in the needed QT_CONFIG() checks. As a drive-by, drop the unused type_traits include. Found in Qt 6.9 API review, but picking down to 6.5, as that's what the original commit did. Note that 6.5 cherry-pick will require to replace with QtCore/qscopedpointer.h because 6da1f72311b844b2232da3067ad6e1e24614e67c was never picked to that branch. Pick-to: 6.5 Change-Id: Ic9c5fe82df38a3bd64829c016de8dcbd9f060315 Reviewed-by: Thiago Macieira (cherry picked from commit 4a6ef7fc6881c7b5ab0b9f6d51a2738ce86cca93) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit be31cbfce87294a6e59e472bd7efa96dfb7a40a4) --- src/corelib/thread/qthreadstorage.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h index 77d15485b6f..909203dc64b 100644 --- a/src/corelib/thread/qthreadstorage.h +++ b/src/corelib/thread/qthreadstorage.h @@ -6,6 +6,10 @@ #include +#if !QT_CONFIG(thread) +#include +#endif + QT_BEGIN_NAMESPACE #if QT_CONFIG(thread) @@ -115,9 +119,6 @@ public: #else // !QT_CONFIG(thread) -#include -#include - template inline bool qThreadStorage_hasLocalData(const std::unique_ptr &data) {