qthreadstorage.h: fix position of namespace macros

The file contains two implementations of the class template, one for
QT_CONFIG(thread) and one for without. Both are in the QT_NAMESPACE,
but each provided their own QT_{BEGIN,END}_NAMESPACE macro pair.

This is unneeded and may throw off scripts which use the macros as
insertion positions (like includemocs, which, however, operates on
.cpp files, not headers).

To fix, move the namespace macro pair to be around the #if
QT_CONFIG(thread) block.

Pick-to: 6.5
Change-Id: I56c1f9a4ef7df0fba54c72d8a213fa92573b826c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8553ffd8d147ecf6a713d12a360027b477dd59c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ee6982605410c62ca68f05f5666f8af069dc3e0e)
This commit is contained in:
Marc Mutz 2024-05-14 06:44:59 +02:00 committed by Qt Cherry-pick Bot
parent b4233422e2
commit 3beb1f5dd8

View File

@ -6,10 +6,9 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#if QT_CONFIG(thread)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if QT_CONFIG(thread)
class Q_CORE_EXPORT QThreadStorageData class Q_CORE_EXPORT QThreadStorageData
{ {
@ -114,16 +113,12 @@ public:
{ qThreadStorage_setLocalData(d, &t); } { qThreadStorage_setLocalData(d, &t); }
}; };
QT_END_NAMESPACE
#else // !QT_CONFIG(thread) #else // !QT_CONFIG(thread)
#include <QtCore/qscopedpointer.h> #include <QtCore/qscopedpointer.h>
#include <type_traits> #include <type_traits>
QT_BEGIN_NAMESPACE
template <typename T, typename U> template <typename T, typename U>
inline bool qThreadStorage_hasLocalData(const QScopedPointer<T, U> &data) inline bool qThreadStorage_hasLocalData(const QScopedPointer<T, U> &data)
{ {
@ -193,8 +188,8 @@ public:
} }
}; };
QT_END_NAMESPACE
#endif // QT_CONFIG(thread) #endif // QT_CONFIG(thread)
QT_END_NAMESPACE
#endif // QTHREADSTORAGE_H #endif // QTHREADSTORAGE_H