summaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-11-04 20:01:55 -0800
committerThiago Macieira <thiago.macieira@intel.com>2020-11-05 13:27:44 -0800
commit6e60921290892ac0fcf625c5025845eb0334880e (patch)
treef9f0a167f4aa27196ace589058fa16bdc4791588 /dist
parent018daa1a28e42c69d542610c4595d344f382008e (diff)
QMap: suppress warning about strict aliasing violation in end()
In: Node *end() { return reinterpret_cast<Node *>(&header); } GCC 10.2 correctly warns that, if you dereferenced this type-punned pointer (which is of type QMapNodeBase), you'd be violating strict- aliasing, as there is no object of type QMapNode<Key, T> there. But no one is supposed to dereference this pointer, it's only used as a sentinel. So simply suppress the warning. qmap.h: In instantiation of ‘QMapData<Key, T>::Node* QMapData<Key, T>::end() [with Key = QString; T = QString; QMapData<Key, T>::Node = QMapNode<QString, QString>]’: qmap.h:921:31: required from ‘int QMap<K, V>::remove(const Key&) [with Key = QString; T = QString]’ qmap.h:215:52: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing] -Wstrict-aliasing (level 3) is part of -Wall. I believe this warning happens with level 2 ("Aggressive, quick, not too precise"), which makes GCC less accurate, but it's an easy fix. Doesn't apply to Qt 6 since there QMap was rewritten on top of std::map. Fixes: QTBUG-88185 Change-Id: I7b9b97ae9b32412abdc6fffd164480bcb515acf5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'dist')
0 files changed, 0 insertions, 0 deletions