]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdbsupport/intrusive-list: sprinkle noexcept
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 12 Aug 2024 17:09:02 +0000 (13:09 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 13 Sep 2024 11:38:56 +0000 (07:38 -0400)
commit96917d0541db09977afaba3e6f8a53bfb31bcf45
tree72cd32968e3a3749923f6b7a0b42a1e4f5e60d1e
parenta1371f3288f2d84cea90a9157ed9a359226969e2
gdbsupport/intrusive-list: sprinkle noexcept

Some methods of intrusive_list are marked noexcept.  But really,
everything in that file could be noexcept.  Add it everywhere.

The only one I had a doubt about is clear_and_dispose: what if the
disposer throws?  The boost equivalent [1] is noexcept and requires the
disposer not to throw.  The rationale is probably the same as for
destructors.  What if the disposer throws for an element in the middle
of the list?  Do you skip the remaining elements?  Do you swallow the
exception and keep calling the disposer for the remaining elements?
It's simpler to say no exceptions allowed.

[1] https://www.boost.org/doc/libs/1_79_0/doc/html/boost/intrusive/list.html#idm33710-bb

Change-Id: I402646cb12c6b7906f4bdc2ad85203d8c8cdf2cc
Reviewed-by: Keith Seitz <keiths@redhat.com>
gdbsupport/intrusive_list.h