summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@digia.com>2014-03-07 13:18:31 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-15 10:46:17 +0100
commitcc0636ea1eb34b654bd14ce840d1ffa5a07e44fe (patch)
tree2694b5a44aa0513dba9f0572c2576382841cc986 /src
parentc6e271da6d1d972ad73a97871baafe57578a69a9 (diff)
Remove level 4 compiler warnings from MSVC.
Task-number: QTBUG-7233 Change-Id: I52067e3a22e98a62fd87415906e54a54ff2d6b49 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Dave McClelland
Diffstat (limited to 'src')
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.h2
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/kernel/qmetatype.h4
-rw-r--r--src/corelib/kernel/qobject_impl.h2
-rw-r--r--src/corelib/tools/qhash.h24
-rw-r--r--src/corelib/tools/qlist.h9
-rw-r--r--src/corelib/tools/qmap.h9
-rw-r--r--src/corelib/tools/qstring.h11
-rw-r--r--src/corelib/tools/qstringbuilder.h8
-rw-r--r--src/corelib/tools/qvector.h9
10 files changed, 73 insertions, 8 deletions
diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h
index b47c30aef6..0969029e37 100644
--- a/src/concurrent/qtconcurrentiteratekernel.h
+++ b/src/concurrent/qtconcurrentiteratekernel.h
@@ -86,6 +86,8 @@ private:
Median<double> controlPartElapsed;
Median<double> userPartElapsed;
int m_blockSize;
+
+ Q_DISABLE_COPY(BlockSizeManager)
};
template <typename T>
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 0e5c4965f9..9b5d78b6fe 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -881,8 +881,11 @@ struct QForeachContainerBase {};
template <typename T>
class QForeachContainer : public QForeachContainerBase {
+ QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE;
public:
inline QForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){}
+ QForeachContainer(const QForeachContainer &other)
+ : c(other.c), brk(other.brk), i(other.i), e(other.e) {}
const T c;
mutable int brk;
mutable typename T::const_iterator i, e;
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 83801a20c5..5e354b3f41 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -771,9 +771,13 @@ struct VariantData
, flags(flags_)
{
}
+ VariantData(const VariantData &other)
+ : metaTypeId(other.metaTypeId), data(other.data), flags(other.flags){}
const int metaTypeId;
const void *data;
const uint flags;
+private:
+ VariantData &operator=(const VariantData &) Q_DECL_EQ_DELETE;
};
template<typename const_iterator>
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index d2996e6e4d..aea9d41c67 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -132,6 +132,8 @@ namespace QtPrivate {
inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, 0); }
protected:
~QSlotObjectBase() {}
+ private:
+ Q_DISABLE_COPY(QSlotObjectBase)
};
// implementation of QSlotObjectBase for which the slot is a pointer to member function of a QObject
// Args and R are the List of arguments and the returntype of the signal to which the slot is connected.
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index d4bf8df442..40e501355c 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -52,6 +52,12 @@
#include <initializer_list>
#endif
+#if defined(Q_CC_MSVC)
+#pragma warning( push )
+#pragma warning( disable : 4311 ) // disable pointer truncation warning
+#pragma warning( disable : 4127 ) // conditional expression is constant
+#endif
+
QT_BEGIN_NAMESPACE
class QBitArray;
@@ -99,18 +105,10 @@ Q_CORE_EXPORT uint qHash(QLatin1String key, uint seed = 0) Q_DECL_NOTHROW;
Q_CORE_EXPORT uint qt_hash(const QString &key) Q_DECL_NOTHROW;
Q_CORE_EXPORT uint qt_hash(const QStringRef &key) Q_DECL_NOTHROW;
-#if defined(Q_CC_MSVC)
-#pragma warning( push )
-#pragma warning( disable : 4311 ) // disable pointer truncation warning
-#endif
template <class T> inline uint qHash(const T *key, uint seed = 0) Q_DECL_NOTHROW
{
return qHash(reinterpret_cast<quintptr>(key), seed);
}
-#if defined(Q_CC_MSVC)
-#pragma warning( pop )
-#endif
-
template<typename T> inline uint qHash(const T &t, uint seed)
Q_DECL_NOEXCEPT_EXPR(noexcept(qHash(t)))
{ return (qHash(t) ^ seed); }
@@ -218,6 +216,9 @@ struct QHashNode
inline QHashNode(const Key &key0, const T &value0, uint hash, QHashNode *n)
: next(n), h(hash), key(key0), value(value0) {}
inline bool same_key(uint h0, const Key &key0) const { return h0 == h && key0 == key; }
+
+private:
+ Q_DISABLE_COPY(QHashNode)
};
template <class Key, class T>
@@ -228,6 +229,9 @@ struct QHashDummyNode
const Key key;
inline QHashDummyNode(const Key &key0, uint hash, QHashNode<Key, T> *n) : next(n), h(hash), key(key0) {}
+
+private:
+ Q_DISABLE_COPY(QHashDummyNode)
};
@@ -1091,4 +1095,8 @@ Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)
QT_END_NAMESPACE
+#if defined(Q_CC_MSVC)
+#pragma warning( pop )
+#endif
+
#endif // QHASH_H
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 16f058b001..3a0d01aa8d 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -58,6 +58,11 @@
#include <limits.h>
#include <string.h>
+#ifdef Q_CC_MSVC
+#pragma warning( push )
+#pragma warning( disable : 4127 ) // "conditional expression is constant"
+#endif
+
QT_BEGIN_NAMESPACE
@@ -937,4 +942,8 @@ Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List)
QT_END_NAMESPACE
+#ifdef Q_CC_MSVC
+#pragma warning( pop )
+#endif
+
#endif // QLIST_H
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index db0cd6a2d6..487039ccfb 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -260,6 +260,11 @@ QMapNode<Key, T> *QMapNode<Key, T>::copy(QMapData<Key, T> *d) const
return n;
}
+#if defined(Q_CC_MSVC)
+#pragma warning( push )
+#pragma warning( disable : 4127 ) // conditional expression is constant
+#endif
+
template <class Key, class T>
void QMapNode<Key, T>::destroySubTree()
{
@@ -275,6 +280,10 @@ void QMapNode<Key, T>::destroySubTree()
}
}
+#if defined(Q_CC_MSVC)
+#pragma warning( pop )
+#endif
+
template <class Key, class T>
void QMapData<Key, T>::deleteNode(QMapNode<Key, T> *z)
{
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 9063f59171..cf0726d831 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -870,6 +870,12 @@ inline QString QString::arg(const QString &a1, const QString &a2, const QString
inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const
{ return section(QString(asep), astart, aend, aflags); }
+#ifdef Q_CC_MSVC
+// "conditional expression is constant"
+#pragma warning(push)
+#pragma warning(disable : 4127)
+#endif
+
inline int QString::toWCharArray(wchar_t *array) const
{
if (sizeof(wchar_t) == sizeof(QChar)) {
@@ -878,6 +884,11 @@ inline int QString::toWCharArray(wchar_t *array) const
}
return toUcs4_helper(d->data(), size(), reinterpret_cast<uint *>(array));
}
+
+#ifdef Q_CC_MSVC
+#pragma warning(pop)
+#endif
+
inline QString QString::fromWCharArray(const wchar_t *string, int size)
{
return sizeof(wchar_t) == sizeof(QChar) ? fromUtf16(reinterpret_cast<const ushort *>(string), size)
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index f0670999d7..befa40081c 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -143,12 +143,16 @@ class QStringBuilder <QString, QString> : public QStringBuilderBase<QStringBuild
{
public:
QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {}
+ QStringBuilder(const QStringBuilder &other) : a(other.a), b(other.b) {}
operator QString() const
{ QString r(a); r += b; return r; }
const QString &a;
const QString &b;
+
+ private:
+ QStringBuilder &operator=(const QStringBuilder &) Q_DECL_EQ_DELETE;
};
template <>
@@ -156,12 +160,16 @@ class QStringBuilder <QByteArray, QByteArray> : public QStringBuilderBase<QStrin
{
public:
QStringBuilder(const QByteArray &a_, const QByteArray &b_) : a(a_), b(b_) {}
+ QStringBuilder(const QStringBuilder &other) : a(other.a), b(other.b) {}
operator QByteArray() const
{ QByteArray r(a); r += b; return r; }
const QByteArray &a;
const QByteArray &b;
+
+ private:
+ QStringBuilder &operator=(const QStringBuilder &) Q_DECL_EQ_DELETE;
};
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 075e8e83e8..b0be98c296 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -287,6 +287,11 @@ void QVector<T>::copyConstruct(const T *srcFrom, const T *srcTo, T *dstFrom)
}
}
+#if defined(Q_CC_MSVC)
+#pragma warning( push )
+#pragma warning( disable : 4127 ) // conditional expression is constant
+#endif
+
template <typename T>
void QVector<T>::destruct(T *from, T *to)
{
@@ -297,6 +302,10 @@ void QVector<T>::destruct(T *from, T *to)
}
}
+#if defined(Q_CC_MSVC)
+#pragma warning( pop )
+#endif
+
template <typename T>
inline QVector<T>::QVector(const QVector<T> &v)
{