diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-24 17:21:09 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-02-24 17:35:48 (GMT) |
commit | cab764871cc9379ca9757f41dca9e3ed9e9d34aa (patch) | |
tree | d790eec1db1d99f241e95c0c8f902c971467aee3 /src | |
parent | e5affc9e4a663fc9f690418619f7d7351d1ea7c9 (diff) | |
download | Qt-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')
-rw-r--r-- | src/corelib/tools/qlist.h | 9 |
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; |