From fbf303ab15adb3e051ecf19e646e61f91808a268 Mon Sep 17 00:00:00 2001 From: paolo Date: Sun, 31 Jan 2010 22:52:25 +0000 Subject: [PATCH] 2010-01-31 Paolo Carlini * testsuite/23_containers/array/requirements/exception/ generation_prohibited.c: Remove, swap can indeed throw (DR 774). * testsuite/util/exception/safety.h (insert_base<__versa_string>): Fix. * testsuite/util/testsuite_container_traits.h (traits<__versa_string>): Enable insert tests. 2010-01-31 Paolo Carlini * include/bits/forward_list.h (forward_list<>::insert_after (const_iterator, size_type, const _Tp&), insert_after(const_iterator, _InputIterator, _InputIterator), insert_after(const_iterator, std::initializer_list<>)): Fix return type per N3000. * testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc: Adjust. * testsuite/23_containers/forward_list/modifiers/2.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156419 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 27 +++++++++++++++++ libstdc++-v3/include/bits/forward_list.h | 17 ++++++++--- .../exception/generation_prohibited.cc | 34 ---------------------- .../forward_list/ext_pointer/modifiers/2.cc | 34 ++++++++++++++-------- .../23_containers/forward_list/modifiers/2.cc | 20 +++++++++---- .../forward_list/requirements/dr438/assign_neg.cc | 2 +- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- .../forward_list/requirements/dr438/insert_neg.cc | 2 +- libstdc++-v3/testsuite/util/exception/safety.h | 10 ++++--- .../testsuite/util/testsuite_container_traits.h | 4 +-- 11 files changed, 88 insertions(+), 66 deletions(-) delete mode 100644 libstdc++-v3/testsuite/23_containers/array/requirements/exception/generation_prohibited.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1c579a003f0..e9dc874e126 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,32 @@ 2010-01-31 Paolo Carlini + * testsuite/23_containers/array/requirements/exception/ + generation_prohibited.c: Remove, swap can indeed throw (DR 774). + + * testsuite/util/exception/safety.h (insert_base<__versa_string>): Fix. + * testsuite/util/testsuite_container_traits.h + (traits<__versa_string>): Enable insert tests. + +2010-01-31 Paolo Carlini + + * include/bits/forward_list.h (forward_list<>::insert_after + (const_iterator, size_type, const _Tp&), insert_after(const_iterator, + _InputIterator, _InputIterator), insert_after(const_iterator, + std::initializer_list<>)): Fix return type per N3000. + * testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc: + Adjust. + * testsuite/23_containers/forward_list/modifiers/2.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/dr438/ + assign_neg.cc: Adjust dg-error line numbers. + * testsuite/23_containers/forward_list/requirements/dr438/ + insert_neg.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/dr438/ + constructor_2_neg.cc: Likewise. + +2010-01-31 Paolo Carlini + Revert last changes. Also revert, among the previous changes: * include/std/condition_variable (condition_variable_any:: wait<>(_Lock&)): Provide definition. diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 10af47e74e1..b90c8cf6d66 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -859,6 +859,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @param pos An iterator into the %forward_list. * @param n Number of elements to be inserted. * @param val Data to be inserted. + * @return pos. * * This function will insert a specified number of copies of the * given data after the location specified by @a pos. @@ -866,11 +867,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ - void + iterator insert_after(const_iterator __pos, size_type __n, const _Tp& __val) { forward_list __tmp(__n, __val, this->get_allocator()); splice_after(__pos, std::move(__tmp)); + return iterator(__const_pointer_cast + (__pos._M_node)); } /** @@ -878,6 +881,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @param position An iterator into the %forward_list. * @param first An input iterator. * @param last An input iterator. + * @return pos. * * This function will insert copies of the data in the range [@a * first,@a last) into the %forward_list after the location specified @@ -887,12 +891,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * does not invalidate iterators and references. */ template - void + iterator insert_after(const_iterator __pos, _InputIterator __first, _InputIterator __last) { forward_list __tmp(__first, __last, this->get_allocator()); splice_after(__pos, std::move(__tmp)); + return iterator(__const_pointer_cast + (__pos._M_node)); } /** @@ -900,6 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * %forward_list after the specified iterator. * @param pos An iterator into the %forward_list. * @param il An initializer_list of value_type. + * @return pos. * * This function will insert copies of the data in the * initializer_list @a il into the %forward_list before the location @@ -908,11 +915,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * This operation is linear in the number of elements inserted and * does not invalidate iterators and references. */ - void + iterator insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) { forward_list __tmp(__il, this->get_allocator()); splice_after(__pos, std::move(__tmp)); + return iterator(__const_pointer_cast + (__pos._M_node)); } /** diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/exception/generation_prohibited.cc deleted file mode 100644 index 5ecf8fb2e39..00000000000 --- a/libstdc++-v3/testsuite/23_containers/array/requirements/exception/generation_prohibited.cc +++ /dev/null @@ -1,34 +0,0 @@ -// { dg-options "-std=gnu++0x -D_GLIBCXX_IS_AGGREGATE" } -// { dg-require-cstdint "" } -// { dg-do run { xfail *-*-* } } - -// 2009-09-09 Benjamin Kosnik - -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -// Container requirement testing, exceptional behavior -int main() -{ - typedef __gnu_cxx::throw_value_random value_type; - typedef std::array test_type; - __gnu_test::generation_prohibited test; - return 0; -} diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc index 00f8fed0bf3..d9a437e09e0 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -38,7 +38,9 @@ test01() std::forward_list > fl( {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); - fl.insert_after(fl.before_begin(), 42); + std::forward_list >::iterator ret + = fl.insert_after(fl.before_begin(), 42); + VERIFY(ret == fl.begin()); VERIFY(fl.front() == 42); } @@ -49,15 +51,17 @@ test02() std::forward_list > fl( {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); - std::forward_list >::const_iterator - pos = fl.cbegin(); + std::forward_list >::const_iterator pos + = fl.cbegin(); ++pos; VERIFY(*pos == 1); // Note: Calling l.insert_after(pos, 5, 42); without the long five // gets resolved to the iterator range version and fails to compile! - fl.insert_after(pos, 5, 42); + std::forward_list >::iterator ret + = fl.insert_after(pos, 5, 42); + VERIFY(ret == pos); VERIFY(*pos == 1); ++pos; @@ -76,14 +80,16 @@ test03() std::forward_list > fl( {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); - std::forward_list >::const_iterator - pos = fl.cbegin(); + std::forward_list >::const_iterator pos + = fl.cbegin(); ++pos; VERIFY(*pos == 1); int i[3] = {666, 777, 888}; - fl.insert_after(pos, i, i+3); + std::forward_list >::iterator ret + = fl.insert_after(pos, i, i + 3); + VERIFY(ret == pos); VERIFY(*pos == 1); ++pos; @@ -107,7 +113,9 @@ test04() ++pos; VERIFY(*pos == 1); - fl.insert_after(pos, {-1, -2, -3, -4, -5}); + std::forward_list >::iterator ret + = fl.insert_after(pos, {-1, -2, -3, -4, -5}); + VERIFY(ret == pos); VERIFY(*pos == 1); ++pos; @@ -123,16 +131,18 @@ test05() std::forward_list > fl( {"AAA", "BBB", "CCC"}); - std::forward_list >::const_iterator - pos = fl.cbegin(); + std::forward_list >:: + const_iterator pos = fl.cbegin(); ++pos; VERIFY(*pos == "BBB"); std::string x( "XXX" ); - fl.insert_after(pos, std::move(x)); + std::forward_list >::iterator ret + = fl.insert_after(pos, std::move(x)); VERIFY(*pos == "BBB"); ++pos; + VERIFY(ret == pos); VERIFY(*pos == "XXX"); ++pos; VERIFY(*pos == "CCC"); diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc index 043a3d741a6..92678f39d69 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -34,7 +34,9 @@ test01() { std::forward_list fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); - fl.insert_after(fl.before_begin(), 42); + std::forward_list::iterator ret = fl.insert_after(fl.before_begin(), + 42); + VERIFY(ret == fl.begin()); VERIFY(fl.front() == 42); } @@ -50,7 +52,8 @@ test02() // Note: Calling l.insert_after(pos, 5, 42); without the long five // gets resolved to the iterator range version and fails to compile! - fl.insert_after(pos, 5, 42); + std::forward_list::iterator ret = fl.insert_after(pos, 5, 42); + VERIFY(ret == pos); VERIFY(*pos == 1); ++pos; @@ -73,7 +76,8 @@ test03() VERIFY(*pos == 1); int i[3] = {666, 777, 888}; - fl.insert_after(pos, i, i+3); + std::forward_list::iterator ret = fl.insert_after(pos, i, i + 3); + VERIFY(ret == pos); VERIFY(*pos == 1); ++pos; @@ -94,7 +98,9 @@ test04() ++pos; VERIFY(*pos == 1); - fl.insert_after(pos, {-1, -2, -3, -4, -5}); + std::forward_list::iterator ret + = fl.insert_after(pos, {-1, -2, -3, -4, -5}); + VERIFY(ret == pos); VERIFY(*pos == 1); ++pos; @@ -114,9 +120,11 @@ test05() VERIFY(*pos == "BBB"); std::string x( "XXX" ); - fl.insert_after(pos, std::move(x)); + std::forward_list::iterator ret + = fl.insert_after(pos, std::move(x)); VERIFY(*pos == "BBB"); ++pos; + VERIFY(ret == pos); VERIFY(*pos == "XXX"); ++pos; VERIFY(*pos == "CCC"); diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc index 1625e3bc76b..7e6e6492a2c 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1205 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc index 5acfcd1f47f..439a7b32191 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1205 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc index dcf69089b00..8184b67d750 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1205 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc index 22574fd081a..0bc1a3d58cb 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1205 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/util/exception/safety.h b/libstdc++-v3/testsuite/util/exception/safety.h index ce9dad4f7ba..4be53185b8e 100644 --- a/libstdc++-v3/testsuite/util/exception/safety.h +++ b/libstdc++-v3/testsuite/util/exception/safety.h @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -512,10 +512,12 @@ namespace __gnu_test insert_base() : _F_insert_point(&container_type::insert) { } }; - template - struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3>> + template class _Tp4> + struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>> { - typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3> container_type; + typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4> + container_type; typedef typename container_type::iterator iterator; typedef typename container_type::value_type value_type; diff --git a/libstdc++-v3/testsuite/util/testsuite_container_traits.h b/libstdc++-v3/testsuite/util/testsuite_container_traits.h index 8e9405cac0e..af375153090 100644 --- a/libstdc++-v3/testsuite/util/testsuite_container_traits.h +++ b/libstdc++-v3/testsuite/util/testsuite_container_traits.h @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -135,7 +135,7 @@ namespace __gnu_test typedef std::true_type is_pointer_aware; typedef std::true_type has_erase; - //typedef std::true_type has_insert; XXX no vstring::insert + typedef std::true_type has_insert; }; template -- 2.11.0