Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-27 Thread Jonathan Wakely
On Mon, 18 Nov 2024 at 19:10, Marc Glisse wrote: > > On Sat, 16 Nov 2024, Jonathan Wakely wrote: > > >>void > >>_M_erase(iterator __position) _GLIBCXX_NOEXCEPT > >>{ > >> + if (__builtin_expect(empty(), 0)) > >> + { > >> + __glibcxx_requires_nonempty

Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-27 Thread Jonathan Wakely
On Mon, 18 Nov 2024 at 18:32, François Dumont wrote: > > > On 18/11/2024 19:24, François Dumont wrote: > > > > On 16/11/2024 02:18, Jonathan Wakely wrote: > >> On Sat, 16 Nov 2024 at 01:09, Jonathan Wakely > >> wrote: > >>> While working on fancy pointer support for the linked lists I noticed > >

Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-18 Thread Marc Glisse
On Sat, 16 Nov 2024, Jonathan Wakely wrote: void _M_erase(iterator __position) _GLIBCXX_NOEXCEPT { + if (__builtin_expect(empty(), 0)) + { + __glibcxx_requires_nonempty(); + return; + } Hmm, I'm having second thoughts about the "re

Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-18 Thread François Dumont
On 18/11/2024 19:24, François Dumont wrote: On 16/11/2024 02:18, Jonathan Wakely wrote: On Sat, 16 Nov 2024 at 01:09, Jonathan Wakely wrote: While working on fancy pointer support for the linked lists I noticed they didn't have any debug assertions. This adds the obvious non-empty assertion

Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-18 Thread François Dumont
On 16/11/2024 02:18, Jonathan Wakely wrote: On Sat, 16 Nov 2024 at 01:09, Jonathan Wakely wrote: While working on fancy pointer support for the linked lists I noticed they didn't have any debug assertions. This adds the obvious non-empty assertions to front(), back(), pop_front() and pop_back

Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-15 Thread Jonathan Wakely
On Sat, 16 Nov 2024 at 01:09, Jonathan Wakely wrote: > > While working on fancy pointer support for the linked lists I noticed > they didn't have any debug assertions. This adds the obvious non-empty > assertions to front(), back(), pop_front() and pop_back(). > > For the pop members, adding an as

Re: [PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-15 Thread Jonathan Wakely
On Sat, 16 Nov 2024, 01:21 Jonathan Wakely, wrote: > On Sat, 16 Nov 2024 at 01:09, Jonathan Wakely wrote: > > > > While working on fancy pointer support for the linked lists I noticed > > they didn't have any debug assertions. This adds the obvious non-empty > > assertions to front(), back(), po

[PATCH] libstdc++: Add debug assertions to std::list and std::forward_list

2024-11-15 Thread Jonathan Wakely
While working on fancy pointer support for the linked lists I noticed they didn't have any debug assertions. This adds the obvious non-empty assertions to front(), back(), pop_front() and pop_back(). For the pop members, adding an assertion to the underlying function that erases a member means it