summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-02-24 17:21:09 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-02-24 17:35:48 (GMT)
commitcab764871cc9379ca9757f41dca9e3ed9e9d34aa (patch)
treed790eec1db1d99f241e95c0c8f902c971467aee3 /src/corelib/tools/qlist.h
parente5affc9e4a663fc9f690418619f7d7351d1ea7c9 (diff)
downloadQt-cab764871cc9379ca9757f41dca9e3ed9e9d34aa.zip
Qt-cab764871cc9379ca9757f41dca9e3ed9e9d34aa.tar.gz
Qt-cab764871cc9379ca9757f41dca9e3ed9e9d34aa.tar.bz2
suppress pointer aliasing warnings
the code as such is safe, as no aliasing can occur here. so it is just a matter of making the compiler shut up. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r--src/corelib/tools/qlist.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 3a29e13..02d434e 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -525,7 +525,8 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
Node *n = reinterpret_cast<Node *>(p.append());
QT_TRY {
- node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ void *ptr = &cpy;
+ node_construct(n, *reinterpret_cast<T *>(ptr));
} QT_CATCH(...) {
--d->end;
QT_RETHROW;
@@ -559,7 +560,8 @@ inline void QList<T>::prepend(const T &t)
PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
Node *n = reinterpret_cast<Node *>(p.prepend());
QT_TRY {
- node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ void *ptr = &cpy;
+ node_construct(n, *reinterpret_cast<T *>(ptr));
} QT_CATCH(...) {
++d->begin;
QT_RETHROW;
@@ -593,7 +595,8 @@ inline void QList<T>::insert(int i, const T &t)
PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
Node *n = reinterpret_cast<Node *>(p.insert(i));
QT_TRY {
- node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ void *ptr = &cpy;
+ node_construct(n, *reinterpret_cast<T *>(ptr));
} QT_CATCH(...) {
p.remove(i);
QT_RETHROW;