[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #18 from Jonathan Wakely --- Our precondition checks never throw, so those functions never throw.
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 Giuseppe D'Angelo changed: What|Removed |Added CC||dangelog at gmail dot com --- Comment #17 from Giuseppe D'Angelo --- Hi, How does all of this intersect with the Lakos' Rule (cf. the very recent P2837 and P2861)? I get that implementations have the freedom of strenghtening the noexcept contract; but is this patch following some specific libstdc++ policy (documented somewhere) -- such as, if a precondition violation is detected, libstdc++ just abort()s the process, so technically speaking, it never throws?
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 Marc Glisse changed: What|Removed |Added Resolution|--- |FIXED Status|WAITING |RESOLVED --- Comment #16 from Marc Glisse --- No idea if there are low hanging fruits. I think the original idea was to get consensus on the idea to add noexcept in various places, and this seems well accepted now. At some point (back when I thought I would have enough free time) my plan was to implement some form of noexcept(auto) as an extension, I think most of the remaining places where we may want to add noexcept would benefit from that. The effort and risk in working around the lack of this feature (writing 10+ lines of nexcept(...), is_nothrow_*, etc) make it not worth it to me.
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 Jonathan Wakely changed: What|Removed |Added Status|NEW |WAITING --- Comment #15 from Jonathan Wakely --- Is there any low-hanging fruit left here? Can we close this? We should accept any patches that strengthen noexcept guarantees elsewhere in the library, we don't need a PR to do so.
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2017-01-18 Ever confirmed|0 |1
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #14 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Sat Feb 22 10:24:11 2014 New Revision: 208041 URL: http://gcc.gnu.org/viewcvs?rev=208041root=gccview=rev Log: 2014-02-22 Marc Glisse marc.gli...@inria.fr PR libstdc++/60308 * include/bits/stl_deque.h (_Deque_base::_Deque_base(const allocator_type)): Remove redundant call to _M_initialize_map. (deque::deque(const allocator_type)): Initialize _Base with a constructor that calls _M_initialize_map. Partial revert: 2013-09-20 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 (_Deque_base) [_Deque_base(const allocator_type)]: Add missing call to _M_initialize_map. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/stl_deque.h
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #11 from Marc Glisse glisse at gcc dot gnu.org --- (In reply to bredelin from comment #10) Was this change intentional? See: http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01101.html and Paolo's reply.
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #12 from Marc Glisse glisse at gcc dot gnu.org --- (In reply to bredelin from comment #10) http://cplusplus.github.io/LWG/lwg-active.html#2193 I suggest you open a separate bugzilla PR for this. Before my patch we were already inconsistent about it.
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #13 from Paolo Carlini paolo.carlini at oracle dot com --- In any case I see that the issue with explicit instantiation is recorded in 2193. Let's see what happens in EWG.
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 bredelin at ucla dot edu changed: What|Removed |Added CC||bredelin at ucla dot edu --- Comment #10 from bredelin at ucla dot edu --- It seems that these changes (see Sep 17th) also made the default constructor explicit. While this does follow the standard, it is the subject of this defect report: http://cplusplus.github.io/LWG/lwg-active.html#2193 Was this change intentional?
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #9 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Wed Sep 25 20:28:12 2013 New Revision: 202924 URL: http://gcc.gnu.org/viewcvs?rev=202924root=gccview=rev Log: 2013-09-25 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after): Mark as noexcept. (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator-, operator++, operator==, operator!=, _M_next]: Likewise. (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*, operator-, operator++, operator==, operator!=, _M_next]: Likewise. (operator==(const _Fwd_list_iterator, const _Fwd_list_const_iterator), operator!=(const _Fwd_list_iterator, const _Fwd_list_const_iterator)): Likewise. * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base, _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base, _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base, const _Node_iterator_base), operator!=(const _Node_iterator_base, const _Node_iterator_base)): Likewise. (_Node_iterator) [_Node_iterator, operator*, operator-, operator++]: Likewise. (_Node_const_iterator) [_Node_const_iterator, operator*, operator-, operator++]: Likewise. * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator, operator=, operator*, operator-, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base, operator _Iterator]: Likewise. (operator==(const _Safe_iterator, const _Safe_iterator), operator!=(const _Safe_iterator, const _Safe_iterator), operator(const _Safe_iterator, const _Safe_iterator), operator=(const _Safe_iterator, const _Safe_iterator), operator(const _Safe_iterator, const _Safe_iterator), operator=(const _Safe_iterator, const _Safe_iterator), operator-(const _Safe_iterator, const _Safe_iterator), operator+(difference_type, const _Safe_iterator)): Likewise. * include/profile/iterator_tracker.h (__iterator_tracker) [__iterator_tracker, base, operator _Iterator, operator-, operator++, operator--, operator=, operator*, operator[], operator+=, operator+, operator-=, operator-]: Likewise. (operator==(const __iterator_tracker, const __iterator_tracker), operator!=(const __iterator_tracker, const __iterator_tracker), operator(const __iterator_tracker, const __iterator_tracker), operator=(const __iterator_tracker, const __iterator_tracker), operator(const __iterator_tracker, const __iterator_tracker), operator=(const __iterator_tracker, const __iterator_tracker), operator-(const __iterator_tracker, const __iterator_tracker), operator+(difference_type, const __iterator_tracker)): Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/forward_list.h trunk/libstdc++-v3/include/bits/hashtable_policy.h trunk/libstdc++-v3/include/debug/safe_iterator.h trunk/libstdc++-v3/include/profile/iterator_tracker.h
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #8 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Tue Sep 24 10:07:32 2013 New Revision: 202861 URL: http://gcc.gnu.org/viewcvs?rev=202861root=gccview=rev Log: 2013-09-24 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 PR libstdc++/56166 * include/bits/basic_string.h (basic_string) [basic_string(basic_string)]: Make the noexcept conditional. [operator=(basic_string), assign(basic_string)]: Link to PR 58265. [begin(), end(), rbegin(), rend(), clear]: Remove noexcept. [pop_back]: Comment on the lack of noexcept. * include/debug/string (basic_string) [basic_string(const _Allocator), basic_string(basic_string), begin(), end(), rbegin(), rend(), clear, operator[](size_type), pop_back]: Comment out noexcept, until vstring replaces basic_string. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/basic_string.h trunk/libstdc++-v3/include/debug/string
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #7 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Fri Sep 20 15:50:09 2013 New Revision: 202781 URL: http://gcc.gnu.org/viewcvs?rev=202781root=gccview=rev Log: 2013-09-20 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 * include/bits/allocator.h (__alloc_swap::_S_do_it, __shrink_to_fit_aux::_S_do_it): Mark as noexcept. * include/bits/basic_string.h (basic_string::_Rep) [_S_empty_rep, _M_is_leaked, _M_is_shared, _M_set_leaked, _M_set_sharable, _M_set_length_and_sharable, _M_dispose]: Likewise. (basic_string::_Alloc_hider::_Alloc_hider): Likewise. (basic_string) [_M_data, _M_rep, _M_ibegin, _M_iend, _M_limit, _M_disjunct, _M_copy, _M_move, _M_assign, _S_copy_chars, _S_compare, _S_empty_rep, shrink_to_fit, operator[] const, front const, back const]: Likewise. [clear]: Link to PR 56166. [swap]: Link to PR 58265. * include/bits/stl_deque.h (_Deque_iterator) [_S_buffer_size, _Deque_iterator, _M_const_cast, operator*, operator-, operator++, operator--, operator+=, operator+, operator-=, operator-, operator[], _M_set_node]: Mark as noexcept. (operator==(const _Deque_iterator, const _Deque_iterator), operator!=(const _Deque_iterator, const _Deque_iterator), operator(const _Deque_iterator, const _Deque_iterator), operator(const _Deque_iterator, const _Deque_iterator), operator=(const _Deque_iterator, const _Deque_iterator), operator=(const _Deque_iterator, const _Deque_iterator), operator-(const _Deque_iterator, const _Deque_iterator), operator+(ptrdiff_t, const _Deque_iterator)): Likewise. (_Deque_base) [_Deque_base(const allocator_type)]: Add missing call to _M_initialize_map. [~_Deque_base, _M_deallocate_node, _M_deallocate_map, _M_destroy_nodes]: Mark as noexcept. (_Deque_base::_Deque_impl) [_Deque_impl(const _Tp_alloc_type), _Deque_impl(_Tp_alloc_type)]: Likewise. (deque) [_S_buffer_size, operator=(deque), shrink_to_fit, operator[], front, back, pop_front, pop_back, swap]: Likewise. [deque(), deque(const allocator_type)]: Merge. * include/debug/deque (deque) [operator=(deque), shrink_to_fit, operator[], front, back, pop_front, pop_back, swap]: Mark as noexcept. * include/profile/deque (deque) [operator=(deque), operator[], front, back, pop_front, pop_back, swap]: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Adjust line number. * testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/allocator.h trunk/libstdc++-v3/include/bits/basic_string.h trunk/libstdc++-v3/include/bits/stl_deque.h trunk/libstdc++-v3/include/debug/deque trunk/libstdc++-v3/include/profile/deque trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #6 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Thu Sep 19 11:40:29 2013 New Revision: 202737 URL: http://gcc.gnu.org/viewcvs?rev=202737root=gccview=rev Log: 2013-09-19 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 * include/bits/stl_tree.h (_Rb_tree_node_base) [_S_minimum, _S_maximum]: Mark as noexcept. (_Rb_tree_iterator) [_Rb_tree_iterator, operator*, operator-, operator++, operator--, operator==, operator!=]: Likewise. (_Rb_tree_const_iterator) [_Rb_tree_const_iterator, _M_const_cast, operator*, operator-, operator++, operator--, operator==, operator!=]: Likewise. (operator==(const _Rb_tree_iterator, const _Rb_tree_const_iterator), operator!=(const _Rb_tree_iterator, const _Rb_tree_const_iterator)): Likewise. (_Rb_tree) [_M_put_node, _M_destroy_node, _M_root, _M_leftmost, _M_rightmost, _M_begin, _M_end, _S_left, _S_right, _S_minimum, _S_maximum]: Likewise. * include/debug/string (basic_string) [basic_string(const _Allocator), shrink_to_fit, operator[], pop_back]: Likewise. * include/ext/vstring.h (__versa_string) [_M_limit, _M_disjunct, _M_ibegin, _M_iend, __versa_string(const _Alloc), operator=(__versa_string), shrink_to_fit, operator[], front, back, assign(__versa_string), swap]: Likewise. (__versa_string) [__versa_string(), __versa_string(const _Alloc)]: Merge. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/stl_tree.h trunk/libstdc++-v3/include/debug/string trunk/libstdc++-v3/include/ext/vstring.h
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #4 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Wed Sep 18 11:21:51 2013 New Revision: 202699 URL: http://gcc.gnu.org/viewcvs?rev=202699root=gccview=rev Log: 2013-09-18 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 * include/bits/list.tcc (_List_base::_M_clear, list::erase): Mark as noexcept. * include/bits/stl_list.h (_List_iterator) [_List_iterator, _M_const_cast, operator*, operator-, operator++, operator--, operator==, operator!=]: Likewise. (_List_const_iterator) [_List_const_iterator, _M_const_cast, operator*, operator-, operator++, operator--, operator==, operator!=]: Likewise. (operator==(const _List_iterator, const _List_const_iterator), operator!=(const _List_iterator, const _List_const_iterator)): Likewise. (_List_impl) [_List_impl(const _Node_alloc_type), _List_impl(_Node_alloc_type)]: Likewise. (_List_base) [_M_put_node, _List_base(const _Node_alloc_type), _List_base(_List_base), _M_clear, _M_init]: Likewise. (list) [list(), list(const allocator_type)]: Merge. (list) [list(const allocator_type), front, back, pop_front, pop_back, erase, _M_erase]: Mark as noexcept. * include/debug/list (list) [list(const _Allocator), front, back, pop_front, pop_back, _M_erase, erase]: Likewise. * include/profile/list (list) [list(const _Allocator), front, back, pop_front, pop_back, erase]: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Adjust line number. * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/list.tcc trunk/libstdc++-v3/include/bits/stl_list.h trunk/libstdc++-v3/include/debug/list trunk/libstdc++-v3/include/profile/list trunk/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc trunk/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc trunk/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc trunk/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #5 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Wed Sep 18 18:31:01 2013 New Revision: 202716 URL: http://gcc.gnu.org/viewcvs?rev=202716root=gccview=rev Log: 2013-09-18 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 * include/bits/stl_iterator.h (__normal_iterator) [__normal_iterator, _M_const_cast, operator*, operator-, operator++, operator--, operator[], operator+=, operator+, operator-=, operator-, base]: Mark as noexcept. (operator==(const __normal_iterator, const __normal_iterator), operator!=(const __normal_iterator, const __normal_iterator), operator(const __normal_iterator, const __normal_iterator), operator(const __normal_iterator, const __normal_iterator), operator=(const __normal_iterator, const __normal_iterator), operator=(const __normal_iterator, const __normal_iterator), operator-(const __normal_iterator, const __normal_iterator), operator+(difference_type, const __normal_iterator)): Likewise. * include/bits/stl_list.h (list) [splice, _M_check_equal_allocators]: Likewise. (list::_M_check_equal_allocators): Abort instead of throwing. * include/debug/array (array) [operator[], front, back]: Mark as noexcept. * include/profile/array (array) [operator[], front, back]: Likewise. * include/std/array (array) [operator[], front, back]: Likewise. * include/debug/list (list::splice): Likewise. * include/profile/list (list::splice): Likewise. * testsuite/23_containers/list/operations/5.cc: Remove file. * testsuite/23_containers/list/operations/5.h: Likewise. Removed: trunk/libstdc++-v3/testsuite/23_containers/list/operations/5.cc trunk/libstdc++-v3/testsuite/23_containers/list/operations/5.h Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/stl_iterator.h trunk/libstdc++-v3/include/bits/stl_list.h trunk/libstdc++-v3/include/debug/array trunk/libstdc++-v3/include/debug/list trunk/libstdc++-v3/include/profile/array trunk/libstdc++-v3/include/profile/list trunk/libstdc++-v3/include/std/array
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #3 from Marc Glisse glisse at gcc dot gnu.org --- Author: glisse Date: Tue Sep 17 12:23:54 2013 New Revision: 202650 URL: http://gcc.gnu.org/viewcvs?rev=202650root=gccview=rev Log: 2013-09-17 Marc Glisse marc.gli...@inria.fr PR libstdc++/58338 * include/bits/stl_vector.h (vector::vector(), vector::vector(const allocator_type)): Merge. (_Vector_impl::_Vector_impl(_Tp_alloc_type const), _Vector_impl::_Vector_impl(_Tp_alloc_type), _Vector_impl::_M_swap_data, _Vector_base::_Vector_base(const allocator_type), _Vector_base::_Vector_base(allocator_type), _Vector_base::_Vector_base(_Vector_base), _Vector_base::~_Vector_base, vector::vector(const allocator_type), vector::operator[], vector::operator[] const, vector::front, vector::front const, vector::back, vector::back const, vector::pop_back, vector::_M_erase_at_end): Mark as noexcept. * include/debug/vector (vector::vector(const _Allocator), vector::operator[], vector::operator[] const, vector::front, vector::front const, vector::back, vector::back const, vector::pop_back, _M_requires_reallocation, _M_update_guaranteed_capacity, _M_invalidate_after_nth): Mark as noexcept. * include/profile/vector (vector::vector(const _Allocator), vector::operator[], vector::operator[] const, vector::front, vector::front const, vector::back, vector::back const): Mark as noexcept. (vector::vector(vector, const _Allocator)): Remove wrong noexcept. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust line number. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/stl_vector.h trunk/libstdc++-v3/include/debug/vector trunk/libstdc++-v3/include/profile/vector trunk/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc trunk/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc trunk/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc trunk/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 --- Comment #2 from Paolo Carlini paolo.carlini at oracle dot com --- ... patches welcome!
[Bug libstdc++/58338] Add noexcept to functions with a narrow contract
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338 Daniel Krügler daniel.kruegler at googlemail dot com changed: What|Removed |Added CC||daniel.kruegler@googlemail. ||com --- Comment #1 from Daniel Krügler daniel.kruegler at googlemail dot com --- I'm also very much in favor of this suggestion.