diff options
author | David Schulz <david.schulz@digia.com> | 2014-03-07 13:18:31 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-15 10:46:17 +0100 |
commit | cc0636ea1eb34b654bd14ce840d1ffa5a07e44fe (patch) | |
tree | 2694b5a44aa0513dba9f0572c2576382841cc986 /src/corelib/tools/qhash.h | |
parent | c6e271da6d1d972ad73a97871baafe57578a69a9 (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/corelib/tools/qhash.h')
-rw-r--r-- | src/corelib/tools/qhash.h | 24 |
1 files changed, 16 insertions, 8 deletions
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 |