From 55689e301c74b2ef20b9283ebb29417ef1657fe2 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 1 Oct 2021 09:29:21 +0200 Subject: [PATCH] Purge Q_NO_TEMPLATE_FRIENDS and platforms lacking support for them Given that we rely on C++17, it should be safe to mandate that level of language support. Change-Id: If07ccb36bea2a5113a8f5aacf635be7d2590baf7 Reviewed-by: Lars Knoll Reviewed-by: Qt CI Bot Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 32 ------------------------- src/corelib/tools/qsharedpointer_impl.h | 12 ---------- src/gui/math3d/qgenericmatrix.h | 4 ---- 3 files changed, 48 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 584f1f79b9..273575c31f 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -409,15 +409,6 @@ documentation. It also follows conventions like _BOOL and this documented */ # elif defined(sinix) # define Q_CC_CDS - -/* The MIPSpro compiler defines __EDG */ -# elif defined(__sgi) -# define Q_CC_MIPS -# define Q_NO_TEMPLATE_FRIENDS -# if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740) -# define Q_OUTOFLINE_TEMPLATE inline -# pragma set woff 3624,3625,3649 /* turn off some harmless warnings */ -# endif # endif /* VxWorks' DIAB toolchain has an additional EDG type C++ compiler @@ -446,9 +437,6 @@ # if __SUNPRO_CC >= 0x550 # define Q_DECL_EXPORT __global # endif -# if __SUNPRO_CC < 0x5a0 -# define Q_NO_TEMPLATE_FRIENDS -# endif # if !defined(_BOOL) # error "Compiler not supported" # endif @@ -467,26 +455,6 @@ # endif # define Q_BROKEN_TEMPLATE_SPECIALIZATION -#elif defined(Q_OS_HPUX) -/* __HP_aCC was not defined in first aCC releases */ -# if defined(__HP_aCC) || __cplusplus >= 199707L -# define Q_NO_TEMPLATE_FRIENDS -# define Q_CC_HPACC -# define Q_FUNC_INFO __PRETTY_FUNCTION__ -# if __HP_aCC-0 < 060000 -# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS -# define Q_DECL_EXPORT __declspec(dllexport) -# define Q_DECL_IMPORT __declspec(dllimport) -# endif -# if __HP_aCC-0 >= 062000 -# define Q_DECL_EXPORT __attribute__((visibility("default"))) -# define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) -# define Q_DECL_IMPORT Q_DECL_EXPORT -# endif -# else -# error "Compiler not supported" -# endif - #else # error "Qt has not been tested with this compiler - see http://www.qt-project.org/" #endif diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 0e51990ae3..0db62d9ef4 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -512,13 +512,9 @@ private: qSwap(this->value, other.value); } -#if defined(Q_NO_TEMPLATE_FRIENDS) -public: -#else template friend class QSharedPointer; template friend class QWeakPointer; template friend QSharedPointer QtSharedPointer::copyAndSetPointer(X * ptr, const QSharedPointer &src); -#endif void ref() const noexcept { d->weakref.ref(); d->strongref.ref(); } inline void internalSet(Data *o, T *actual) @@ -676,12 +672,8 @@ public: private: friend struct QtPrivate::EnableInternalData; -#if defined(Q_NO_TEMPLATE_FRIENDS) -public: -#else template friend class QSharedPointer; template friend class QPointer; -#endif template inline QWeakPointer &assign(X *ptr) @@ -738,12 +730,8 @@ public: inline QSharedPointer sharedFromThis() { return QSharedPointer(weakPointer); } inline QSharedPointer sharedFromThis() const { return QSharedPointer(weakPointer); } -#ifndef Q_NO_TEMPLATE_FRIENDS private: template friend class QSharedPointer; -#else -public: -#endif template inline void initializeFromSharedPointer(const QSharedPointer &ptr) const { diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index 9d8869ff3a..47a77d1e52 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -79,7 +79,6 @@ public: const T *data() const { return *m; } const T *constData() const { return *m; } -#if !defined(Q_NO_TEMPLATE_FRIENDS) template friend QGenericMatrix operator+(const QGenericMatrix& m1, const QGenericMatrix& m2); template @@ -96,13 +95,10 @@ public: friend QGenericMatrix operator/(const QGenericMatrix& matrix, TT divisor); private: -#endif T m[N][M]; // Column-major order to match OpenGL. -#if !defined(Q_NO_TEMPLATE_FRIENDS) template friend class QGenericMatrix; -#endif }; template class QTypeInfo >