joycond
joycond copied to clipboard
Fix -Warray-bounds warnings raised by GCC 16
Otherwise you get this:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr.h:53,
from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/memory:82,
from /var/tmp/portage/games-util/joycond-0.1.0_p20250412/work/joycond-39d5728d41b70840342ddc116a59125b337fbde2/include/ctlr_mgr.h:6,
from /var/tmp/portage/games-util/joycond-0.1.0_p20250412/work/joycond-39d5728d41b70840342ddc116a59125b337fbde2/src/ctlr_mgr.cpp:1:
In destructor ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::~_Sp_counted_ptr_inplace() [with _Tp = epoll_subscriber; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
inlined from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::~_Sp_counted_ptr_inplace() [with _Tp = epoll_subscriber; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:670:45,
inlined from ‘void std::_Sp_counted_base<_Lp>::_M_destroy() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:143:9,
inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:424:18,
inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:392:5,
inlined from ‘std::__shared_count<_Lp>::~__shared_count() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1129:21,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::~__shared_ptr() [with _Tp = phys_ctlr; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1603:7,
inlined from ‘std::shared_ptr<phys_ctlr>::~shared_ptr()’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr.h:175:11,
inlined from ‘void ctlr_mgr::add_ctlr(const std::string&, const std::string&)’ at /var/tmp/portage/games-util/joycond-0.1.0_p20250412/work/joycond-39d5728d41b70840342ddc116a59125b337fbde2/src/ctlr_mgr.cpp:249:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:670:45: warning: array subscript ‘std::_Sp_counted_ptr_inplace<epoll_subscriber, std::allocator<void>, __gnu_cxx::_S_atomic>[0]’ is partly outside array bounds of ‘unsigned char [24]’ [-Warray-bounds=]
670 | ~_Sp_counted_ptr_inplace() noexcept { }
| ^
In constructor ‘std::__shared_count<_Lp>::__shared_count(_Ptr) [with _Ptr = phys_ctlr*; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
inlined from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, std::false_type) [with _Ptr = phys_ctlr*; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:985:22,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Yp*) [with _Yp = phys_ctlr; <template-parameter-2-2> = void; _Tp = phys_ctlr; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1548:17,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::_SafeConv<_Yp> std::__shared_ptr<_Tp, _Lp>::reset(_Yp*) [with _Yp = phys_ctlr; _Tp = phys_ctlr; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1729:4,
inlined from ‘void ctlr_mgr::add_ctlr(const std::string&, const std::string&)’ at /var/tmp/portage/games-util/joycond-0.1.0_p20250412/work/joycond-39d5728d41b70840342ddc116a59125b337fbde2/src/ctlr_mgr.cpp:167:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:974:23: note: object of size 24 allocated by ‘operator new’
974 | _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In destructor ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::~_Sp_counted_ptr_inplace() [with _Tp = epoll_subscriber; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
inlined from ‘void std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_M_destroy() [with _Tp = epoll_subscriber; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:684:32,
inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:424:18,
inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:392:5,
inlined from ‘std::__shared_count<_Lp>::~__shared_count() [with __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1129:21,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::~__shared_ptr() [with _Tp = phys_ctlr; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1603:7,
inlined from ‘std::shared_ptr<phys_ctlr>::~shared_ptr()’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr.h:175:11,
inlined from ‘void ctlr_mgr::add_ctlr(const std::string&, const std::string&)’ at /var/tmp/portage/games-util/joycond-0.1.0_p20250412/work/joycond-39d5728d41b70840342ddc116a59125b337fbde2/src/ctlr_mgr.cpp:249:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:670:45: warning: array subscript ‘std::_Sp_counted_ptr_inplace<epoll_subscriber, std::allocator<void>, __gnu_cxx::_S_atomic>[0]’ is partly outside array bounds of ‘unsigned char [24]’ [-Warray-bounds=]
670 | ~_Sp_counted_ptr_inplace() noexcept { }
| ^
In constructor ‘std::__shared_count<_Lp>::__shared_count(_Ptr) [with _Ptr = phys_ctlr*; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
inlined from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, std::false_type) [with _Ptr = phys_ctlr*; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:985:22,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Yp*) [with _Yp = phys_ctlr; <template-parameter-2-2> = void; _Tp = phys_ctlr; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1548:17,
inlined from ‘std::__shared_ptr<_Tp, _Lp>::_SafeConv<_Yp> std::__shared_ptr<_Tp, _Lp>::reset(_Yp*) [with _Yp = phys_ctlr; _Tp = phys_ctlr; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:1729:4,
inlined from ‘void ctlr_mgr::add_ctlr(const std::string&, const std::string&)’ at /var/tmp/portage/games-util/joycond-0.1.0_p20250412/work/joycond-39d5728d41b70840342ddc116a59125b337fbde2/src/ctlr_mgr.cpp:167:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/shared_ptr_base.h:974:23: note: object of size 24 allocated by ‘operator new’
974 | _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~