aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-01-31 22:52:25 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-01-31 22:52:25 +0000
commit22977dce58648cd7da11e07e4373d974e256663a (patch)
tree794c9176f6d2862a3944bbddc03e51589f4b58fa
parent7adac79a3d5420b9683e9fe38b2b526f26c2c225 (diff)
downloadgcc-22977dce58648cd7da11e07e4373d974e256663a.zip
gcc-22977dce58648cd7da11e07e4373d974e256663a.tar.gz
gcc-22977dce58648cd7da11e07e4373d974e256663a.tar.bz2
generation_prohibited.c: Remove, swap can indeed throw (DR 774).
2010-01-31 Paolo Carlini <paolo.carlini@oracle.com> * 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 <paolo.carlini@oracle.com> * 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. From-SVN: r156419
-rw-r--r--libstdc++-v3/ChangeLog27
-rw-r--r--libstdc++-v3/include/bits/forward_list.h17
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/exception/generation_prohibited.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/modifiers/2.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/modifiers/2.cc20
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/util/exception/safety.h10
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_container_traits.h4
11 files changed, 88 insertions, 66 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1c579a0..e9dc874 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,32 @@
2010-01-31 Paolo Carlini <paolo.carlini@oracle.com>
+ * 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 <paolo.carlini@oracle.com>
+
+ * 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 <paolo.carlini@oracle.com>
+
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 10af47e..b90c8cf 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -1,6 +1,6 @@
// <forward_list.h> -*- 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<typename _Node_base::_Pointer>
+ (__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<typename _InputIterator>
- 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<typename _Node_base::_Pointer>
+ (__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<typename _Node_base::_Pointer>
+ (__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 5ecf8fb..0000000
--- 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 <benjamin@redhat.com>
-
-// 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
-// <http://www.gnu.org/licenses/>.
-
-#include <array>
-#include <exception/safety.h>
-
-// Container requirement testing, exceptional behavior
-int main()
-{
- typedef __gnu_cxx::throw_value_random value_type;
- typedef std::array<value_type, 129> test_type;
- __gnu_test::generation_prohibited<test_type> 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 00f8fed..d9a437e 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<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- fl.insert_after(fl.before_begin(), 42);
+ std::forward_list<int, _ExtPtr_allocator<int> >::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<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator
- pos = fl.cbegin();
+ std::forward_list<int, _ExtPtr_allocator<int> >::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<int, _ExtPtr_allocator<int> >::iterator ret
+ = fl.insert_after(pos, 5, 42);
+ VERIFY(ret == pos);
VERIFY(*pos == 1);
++pos;
@@ -76,14 +80,16 @@ test03()
std::forward_list<int, _ExtPtr_allocator<int> > fl(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- std::forward_list<int, _ExtPtr_allocator<int> >::const_iterator
- pos = fl.cbegin();
+ std::forward_list<int, _ExtPtr_allocator<int> >::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<int, _ExtPtr_allocator<int> >::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<int, _ExtPtr_allocator<int> >::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<std::string, _ExtPtr_allocator<std::string> > fl(
{"AAA", "BBB", "CCC"});
- std::forward_list<std::string, _ExtPtr_allocator<std::string> >::const_iterator
- pos = fl.cbegin();
+ std::forward_list<std::string, _ExtPtr_allocator<std::string> >::
+ const_iterator pos = fl.cbegin();
++pos;
VERIFY(*pos == "BBB");
std::string x( "XXX" );
- fl.insert_after(pos, std::move(x));
+ std::forward_list<std::string, _ExtPtr_allocator<std::string> >::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 043a3d7..92678f3 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<int> fl({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
- fl.insert_after(fl.before_begin(), 42);
+ std::forward_list<int>::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<int>::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<int>::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<int>::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<std::string>::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 1625e3b..7e6e649 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 5acfcd1..439a7b3 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 dcf6908..8184b67 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 22574fd..0bc1a3d 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 ce9dad4..4be5318 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<typename _Tp1, typename _Tp2, typename _Tp3>
- struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3>>
+ template<typename _Tp1, typename _Tp2, typename _Tp3,
+ template <typename, typename, typename> 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 8e9405c..af37515 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<rc>::insert
+ typedef std::true_type has_insert;
};
template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>