warnings with gcc4

Tomáš Kazmar Tomash.Kazmar at seznam.cz
Tue Oct 9 16:14:31 UTC 2007


Hi,

  first thank you all for this library, it is minimalist, adaptable and
really easy to use:)

Second I hit some warnigns compiling the example with gcc 4.2.1.
Some initialization syntax things which can be easily fixed and
some warnings about strict aliasing which can be turned off.
I attach a diff to illustrate.


Regards,
Tomas


The latter warnings look really awful and makes compiler output
unreadable:

../kdtree++/kdtree.hpp: In member function 'KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_root() const [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:164:   instantiated from 'KDTree::_Iterator<_Val, const _Val&, const _Val*> KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::insert(const _Val&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:35:   instantiated from here
../kdtree++/kdtree.hpp:683: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In member function 'KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_rightmost() const [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:168:   instantiated from 'KDTree::_Iterator<_Val, const _Val&, const _Val*> KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::insert(const _Val&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:35:   instantiated from here
../kdtree++/kdtree.hpp:695: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In member function 'KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_leftmost() const [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:168:   instantiated from 'KDTree::_Iterator<_Val, const _Val&, const _Val*> KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::insert(const _Val&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:35:   instantiated from here
../kdtree++/kdtree.hpp:689: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In static member function 'static KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_left(KDTree::_Node<_Val>*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:840:   instantiated from 'std::ostream& KDTree::operator<<(std::ostream&, const KDTree::KDTree<__Tp_K, _Tp_Val, _Tp_Acc, _Tp_Cmp, _Tp_Alloc>&) [with unsigned int __Tp_K = 3u, _Tp_Val = triplet, _Tp_Acc = std::pointer_to_binary_function<triplet, int, double>, _Tp_Cmp = std::less<double>, _Tp_Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:46:   instantiated from here
../kdtree++/kdtree.hpp:719: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In static member function 'static KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_right(KDTree::_Node<_Val>*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:841:   instantiated from 'std::ostream& KDTree::operator<<(std::ostream&, const KDTree::KDTree<__Tp_K, _Tp_Val, _Tp_Acc, _Tp_Cmp, _Tp_Alloc>&) [with unsigned int __Tp_K = 3u, _Tp_Val = triplet, _Tp_Acc = std::pointer_to_binary_function<triplet, int, double>, _Tp_Cmp = std::less<double>, _Tp_Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:46:   instantiated from here
../kdtree++/kdtree.hpp:731: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In static member function 'static KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_parent(KDTree::_Node<_Val>*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:206:   instantiated from 'void KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::erase(const KDTree::_Iterator<_Val, const _Val&, const _Val*>&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:196:   instantiated from 'void KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::erase(const _Val&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:48:   instantiated from here
../kdtree++/kdtree.hpp:707: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In static member function 'static KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_right(KDTree::_Node_base*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:737:   instantiated from 'static bool KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_is_leaf(KDTree::_Node_base*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:375:   instantiated from 'KDTree::_Node<_Val>* KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_get_erase_replacement(KDTree::_Node<_Val>*, size_t) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:368:   instantiated from 'KDTree::_Node<_Val>* KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_erase(KDTree::_Node<_Val>*, size_t) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:207:   instantiated from 'void KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::erase(const KDTree::_Iterator<_Val, const _Val&, const _Val*>&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:196:   instantiated from 'void KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::erase(const _Val&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:48:   instantiated from here
../kdtree++/kdtree.hpp:725: warning: dereferencing type-punned pointer will break strict-aliasing rules
../kdtree++/kdtree.hpp: In static member function 'static KDTree::_Node<_Val>*& KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_left(KDTree::_Node_base*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]':
../kdtree++/kdtree.hpp:737:   instantiated from 'static bool KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_S_is_leaf(KDTree::_Node_base*) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:375:   instantiated from 'KDTree::_Node<_Val>* KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_get_erase_replacement(KDTree::_Node<_Val>*, size_t) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:368:   instantiated from 'KDTree::_Node<_Val>* KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::_M_erase(KDTree::_Node<_Val>*, size_t) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:207:   instantiated from 'void KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::erase(const KDTree::_Iterator<_Val, const _Val&, const _Val*>&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
../kdtree++/kdtree.hpp:196:   instantiated from 'void KDTree::KDTree<__K, _Val, _Acc, _Cmp, _Alloc>::erase(const _Val&) [with unsigned int __K = 3u, _Val = triplet, _Acc = std::pointer_to_binary_function<triplet, int, double>, _Cmp = std::less<double>, _Alloc = std::allocator<KDTree::_Node<triplet> >]'
test_kdtree.cpp:48:   instantiated from here
../kdtree++/kdtree.hpp:713: warning: dereferencing type-punned pointer will break strict-aliasing rules
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc4.diff
Type: text/x-patch
Size: 2102 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20071009/5208d408/attachment.bin 


More information about the libkdtree-devel mailing list