Commit 861de21e by Benjamin Kosnik

PR libstdc++/21772 part 1

2009-12-15  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/21772 part 1
	* include/ext/throw_allocator.h: Rework.
	(__gnu_cxx::throw_allocator): To...
	(__gnu_cxx::throw_allocator_limit): ...this.
	(__gnu_cxx::throw_allocator_random): ...and this.
	(throw_value_base, throw_value_limit, throw_value_random): Add.
	(condition_base, random_condition, limit_condition): Add.
	(forced_exception_error): To...
	(forced_error): ...this.
	* testsuite/ext/throw_value: New.
	* testsuite/ext/throw_value/cons.cc: New.
	* testsuite/ext/throw_allocator/deallocate_global.cc: Adjust for
	throw_allocator, forced_exception_error changes.
	* testsuite/ext/throw_allocator/check_delete.cc: Same.
	* testsuite/ext/throw_allocator/check_allocate_max_size.cc: Same.
	* testsuite/ext/throw_allocator/check_deallocate_null.cc: Same.
	* testsuite/ext/throw_allocator/explicit_instantiation.cc: Same.
	* testsuite/ext/throw_allocator/check_new.cc: Same.
	* testsuite/ext/throw_allocator/variadic_construct.cc: Same.
	* testsuite/ext/throw_allocator/deallocate_local.cc: Same.
	* testsuite/23_containers/list/modifiers/insert/25288.cc: Same.
	* testsuite/23_containers/list/modifiers/insert/25288.h: Same.
	* testsuite/util/regression/common_type.hpp: Same.
	* testsuite/util/regression/rand/priority_queue/
	container_rand_regression_test.tcc: Same.
	* testsuite/util/regression/rand/assoc/
	container_rand_regression_test.h: Same.
	* testsuite/util/regression/rand/assoc/
	container_rand_regression_test.tcc: Same.
	* testsuite/util/regression/basic_type.hpp: Same.

	* testsuite/ext/forced_exception_error/cons_virtual_derivation.cc: To...
	* testsuite/ext/forced_error/cons_virtual_derivation.cc: ...this, same.

From-SVN: r155283
parent c7d9f803
2009-12-15 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/21772 part 1
* include/ext/throw_allocator.h: Rework.
(__gnu_cxx::throw_allocator): To...
(__gnu_cxx::throw_allocator_limit): ...this.
(__gnu_cxx::throw_allocator_random): ...and this.
(throw_value_base, throw_value_limit, throw_value_random): Add.
(condition_base, random_condition, limit_condition): Add.
(forced_exception_error): To...
(forced_error): ...this.
* testsuite/ext/throw_value: New.
* testsuite/ext/throw_value/cons.cc: New.
* testsuite/ext/throw_allocator/deallocate_global.cc: Adjust for
throw_allocator, forced_exception_error changes.
* testsuite/ext/throw_allocator/check_delete.cc: Same.
* testsuite/ext/throw_allocator/check_allocate_max_size.cc: Same.
* testsuite/ext/throw_allocator/check_deallocate_null.cc: Same.
* testsuite/ext/throw_allocator/explicit_instantiation.cc: Same.
* testsuite/ext/throw_allocator/check_new.cc: Same.
* testsuite/ext/throw_allocator/variadic_construct.cc: Same.
* testsuite/ext/throw_allocator/deallocate_local.cc: Same.
* testsuite/23_containers/list/modifiers/insert/25288.cc: Same.
* testsuite/23_containers/list/modifiers/insert/25288.h: Same.
* testsuite/util/regression/common_type.hpp: Same.
* testsuite/util/regression/rand/priority_queue/
container_rand_regression_test.tcc: Same.
* testsuite/util/regression/rand/assoc/
container_rand_regression_test.h: Same.
* testsuite/util/regression/rand/assoc/
container_rand_regression_test.tcc: Same.
* testsuite/util/regression/basic_type.hpp: Same.
* testsuite/ext/forced_exception_error/cons_virtual_derivation.cc: To...
* testsuite/ext/forced_error/cons_virtual_derivation.cc: ...this, same.
2009-12-15 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/42381
......@@ -165,7 +201,7 @@
2009-12-10 Paolo Carlini <paolo.carlini@oracle.com>
Revert:
2009-12-03 Paolo Carlini <paolo.carlini@oracle.com>
2009-12-03 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/42261
* include/bits/basic_string.h (_S_construct_aux(_Integer, _Integer,
......@@ -295,21 +331,21 @@
2009-11-30 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/tr1_impl/functional (function): Add rvalue support and
tweak doxygen markup.
* testsuite/20_util/function/assign/move.cc: New.
* testsuite/20_util/function/cons/move.cc: New.
* testsuite/20_util/function/invoke/move_only.cc: New.
* testsuite/20_util/function/cmp/cmp_neg.cc: New.
* testsuite/20_util/function/1.cc: Copy from testsuite/tr1/.
* testsuite/20_util/function/2.cc: Likewise.
* testsuite/20_util/function/3.cc: Likewise.
* testsuite/20_util/function/4.cc: Likewise.
* testsuite/20_util/function/5.cc: Likewise.
* testsuite/20_util/function/6.cc: Likewise.
* testsuite/20_util/function/7.cc: Likewise.
* testsuite/20_util/function/8.cc: Likewise.
* testsuite/20_util/function/9.cc: Likewise.
* include/tr1_impl/functional (function): Add rvalue support and
tweak doxygen markup.
* testsuite/20_util/function/assign/move.cc: New.
* testsuite/20_util/function/cons/move.cc: New.
* testsuite/20_util/function/invoke/move_only.cc: New.
* testsuite/20_util/function/cmp/cmp_neg.cc: New.
* testsuite/20_util/function/1.cc: Copy from testsuite/tr1/.
* testsuite/20_util/function/2.cc: Likewise.
* testsuite/20_util/function/3.cc: Likewise.
* testsuite/20_util/function/4.cc: Likewise.
* testsuite/20_util/function/5.cc: Likewise.
* testsuite/20_util/function/6.cc: Likewise.
* testsuite/20_util/function/7.cc: Likewise.
* testsuite/20_util/function/8.cc: Likewise.
* testsuite/20_util/function/9.cc: Likewise.
2009-11-29 Jonathan Wakely <jwakely.gcc@gmail.com>
......@@ -374,10 +410,10 @@
2009-11-19 Johannes Singler <singler@kit.edu>
* include/parallel/partition.h (__parallel_partition): Correctly
initialize chunk size.
(__parallel_nth_element): Respect nth_element_minimal_n. Use
sequential nth_element as base case, instead of sequential sort.
* include/parallel/partition.h (__parallel_partition): Correctly
initialize chunk size.
(__parallel_nth_element): Respect nth_element_minimal_n. Use
sequential nth_element as base case, instead of sequential sort.
2009-11-17 Benjamin Kosnik <bkoz@redhat.com>
......@@ -848,26 +884,26 @@
009-10-20 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/41773
Revert:
2009-10-20 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/basic_string.h (_S_construct(const _CharT*, size_type,
const _Alloc&)): New, declare.
(_S_construct(_CharT*, _CharT*, const _Alloc&),
_S_construct(const _CharT*, const _CharT*, const _Alloc&),
_S_construct(iterator, iterator, const _Alloc&),
_S_construct(const_iterator, const_iterator, const _Alloc&)): New,
forward to the latter.
* include/bits/basic_string.tcc (_S_construct(const _CharT*,
size_type, const _Alloc&)): Define.
(basic_string(const basic_string&, size_type, size_type),
basic_string(const basic_string&, size_type, size_type,
const _Alloc&), basic_string(const _CharT*, size_type,
const _Alloc&), basic_string(const _CharT*, const _Alloc&),
basic_string(initializer_list<>, const _Alloc&)): Call the latter.
* config/abi/pre/gnu.ver: Remove recently added exports.
* src/string-inst.cc: Remove instantiations.
PR libstdc++/41773
Revert:
2009-10-20 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/basic_string.h (_S_construct(const _CharT*, size_type,
const _Alloc&)): New, declare.
(_S_construct(_CharT*, _CharT*, const _Alloc&),
_S_construct(const _CharT*, const _CharT*, const _Alloc&),
_S_construct(iterator, iterator, const _Alloc&),
_S_construct(const_iterator, const_iterator, const _Alloc&)): New,
forward to the latter.
* include/bits/basic_string.tcc (_S_construct(const _CharT*,
size_type, const _Alloc&)): Define.
(basic_string(const basic_string&, size_type, size_type),
basic_string(const basic_string&, size_type, size_type,
const _Alloc&), basic_string(const _CharT*, size_type,
const _Alloc&), basic_string(const _CharT*, const _Alloc&),
basic_string(initializer_list<>, const _Alloc&)): Call the latter.
* config/abi/pre/gnu.ver: Remove recently added exports.
* src/string-inst.cc: Remove instantiations.
2009-10-20 Paolo Carlini <paolo.carlini@oracle.com>
......
......@@ -23,7 +23,7 @@
int main()
{
typedef int value_type;
typedef __gnu_cxx::throw_allocator<value_type> allocator_type;
typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
typedef std::list<value_type, allocator_type> list_type;
insert1<list_type>();
......
......@@ -47,7 +47,7 @@ void insert1()
list1.insert(list1.begin(), 10, 99);
VERIFY( false );
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
VERIFY( true );
}
......@@ -74,7 +74,7 @@ void insert1()
list2.insert(list2.begin(), data, data + 10);
VERIFY( false );
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
VERIFY( true );
}
......
......@@ -24,7 +24,7 @@
int main()
{
typedef __gnu_cxx::forced_exception_error test_type;
typedef __gnu_cxx::forced_error test_type;
__gnu_test::diamond_derivation<test_type, true>::test();
return 0;
}
......@@ -24,7 +24,7 @@
int main()
{
typedef int value_type;
typedef __gnu_cxx::throw_allocator<value_type> allocator_type;
typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
__gnu_test::check_allocate_max_size<allocator_type>();
return 0;
}
......@@ -24,7 +24,7 @@
int main()
{
typedef int value_type;
typedef __gnu_cxx::throw_allocator<value_type> allocator_type;
typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
try { __gnu_test::check_deallocate_null<allocator_type>(); }
catch (std::logic_error&)
......
......@@ -24,7 +24,7 @@
int main()
{
typedef __gnu_cxx::throw_allocator<unsigned int> allocator_type;
typedef __gnu_cxx::throw_allocator_random<unsigned int> allocator_type;
__gnu_test::check_delete<allocator_type, true>();
return 0;
}
......@@ -24,7 +24,7 @@
int main()
{
typedef __gnu_cxx::throw_allocator<unsigned int> allocator_type;
typedef __gnu_cxx::throw_allocator_random<unsigned int> allocator_type;
__gnu_test::check_new<allocator_type, true>();
return 0;
}
......@@ -25,7 +25,7 @@
typedef char char_t;
typedef std::char_traits<char_t> traits_t;
typedef __gnu_cxx::throw_allocator<char_t> allocator_t;
typedef __gnu_cxx::throw_allocator_random<char_t> allocator_t;
typedef std::basic_string<char_t, traits_t, allocator_t> string_t;
string_t s("bayou bend");
......
......@@ -24,7 +24,7 @@
typedef char char_t;
typedef std::char_traits<char_t> traits_t;
typedef __gnu_cxx::throw_allocator<char_t> allocator_t;
typedef __gnu_cxx::throw_allocator_random<char_t> allocator_t;
typedef std::basic_string<char_t, traits_t, allocator_t> string_t;
int main()
......
......@@ -21,4 +21,5 @@
#include <cstdlib>
#include <ext/throw_allocator.h>
template class __gnu_cxx::throw_allocator<int>;
template class __gnu_cxx::throw_allocator_random<int>;
template class __gnu_cxx::throw_allocator_limit<int>;
......@@ -29,7 +29,7 @@ void test01()
{
bool test __attribute__((unused)) = true;
typedef std::pair<int, char> pair_type;
__gnu_cxx::throw_allocator<pair_type> alloc1;
__gnu_cxx::throw_allocator_random<pair_type> alloc1;
pair_type* ptp1 = alloc1.allocate(1);
alloc1.construct(ptp1, 3, 'a');
......
// { dg-options "-std=gnu++0x" }
// 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 <type_traits>
#include <ext/throw_allocator.h>
void foo1()
{
typedef __gnu_cxx::throw_value_limit value_type;
value_type v1;
value_type v2(v2);
value_type v3(value_type());
}
bool foo2()
{
typedef __gnu_cxx::throw_value_limit value_type;
bool b = std::is_convertible<value_type, value_type>::value;
return b;
}
int main()
{
foo1();
foo2();
return 0;
}
......@@ -46,7 +46,7 @@ namespace test
{
#define PB_DS_BASE_C_DEC \
std::basic_string<char, std::char_traits<char>, \
__gnu_cxx::throw_allocator<char> >
__gnu_cxx::throw_allocator_random<char> >
struct basic_type : public PB_DS_BASE_C_DEC
{
......
......@@ -46,7 +46,7 @@ namespace __gnu_pbds
{
namespace test
{
typedef __gnu_cxx::throw_allocator<basic_type> alloc_type;
typedef __gnu_cxx::throw_allocator_random<basic_type> alloc_type;
struct hash
{
......
......@@ -80,7 +80,7 @@ namespace detail
typedef typename test_traits::native_type native_type;
typedef twister_rand_gen gen;
typedef __gnu_pbds::container_traits<Cntnr> container_traits;
typedef __gnu_cxx::throw_allocator<char> alloc_t;
typedef __gnu_cxx::throw_allocator_random<char> alloc_t;
enum op
{
......
......@@ -66,7 +66,7 @@ default_constructor()
{
m_p_c = new Cntnr;
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -107,7 +107,7 @@ copy_constructor()
p_c = new Cntnr(*m_p_c);
std::swap(p_c, m_p_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -134,7 +134,7 @@ assignment_operator()
* p_c =* m_p_c;
std::swap(p_c, m_p_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -210,7 +210,7 @@ it_constructor_imp(__gnu_pbds::cc_hash_tag)
};
std::swap(p_c, m_p_c);
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -293,7 +293,7 @@ it_constructor_imp(__gnu_pbds::gp_hash_tag)
};
std::swap(p_c, m_p_c);
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -329,7 +329,7 @@ it_constructor_imp(__gnu_pbds::tree_tag)
};
std::swap(p_c, m_p_c);
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -354,7 +354,7 @@ it_constructor_imp(__gnu_pbds::list_update_tag)
p_c = new Cntnr(m_p_c->begin(), m_p_c->end());
std::swap(p_c, m_p_c);
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -392,7 +392,7 @@ it_constructor_imp(__gnu_pbds::pat_trie_tag)
std::swap(p_c, m_p_c);
}
catch (__gnu_cxx::forced_exception_error&)
catch (__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -1088,7 +1088,7 @@ insert()
}
m_native_c.insert(test_traits::native_value(v));
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -1139,7 +1139,7 @@ subscript_imp(__gnu_pbds::detail::false_type)
m_native_c[test_traits::native_value(v).first] =
test_traits::native_value(v).second;
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -1164,7 +1164,7 @@ subscript_imp(__gnu_pbds::detail::true_type)
(*m_p_c)[v] = __gnu_pbds::null_mapped_type();
m_native_c.insert(test_traits::native_value(v));
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -1213,7 +1213,7 @@ erase()
PB_DS_THROW_IF_FAILED(m_p_c->find(k) == m_p_c->end(), "",
m_p_c, &m_native_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
......@@ -1251,7 +1251,7 @@ erase_if()
PB_DS_THROW_IF_FAILED(ersd == native_ersd,
ersd << " " << native_ersd, m_p_c, &m_native_c);
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
PB_DS_THROW_IF_FAILED(container_traits::erase_can_throw,
......@@ -1329,7 +1329,7 @@ erase_it_imp(__gnu_pbds::detail::true_type)
if (range_guarantee)
PB_DS_THROW_IF_FAILED(next_ers_it == next_it, "", m_p_c, &m_native_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
PB_DS_THROW_IF_FAILED(container_traits::erase_can_throw, container_traits::erase_can_throw, m_p_c, &m_native_c);
......@@ -1392,7 +1392,7 @@ erase_rev_it_imp(__gnu_pbds::detail::true_type)
if (native_it != m_native_c.end())
m_native_c.erase(native_it);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
PB_DS_THROW_IF_FAILED(container_traits::erase_can_throw,
......@@ -1763,7 +1763,7 @@ split_join_imp(__gnu_pbds::detail::true_type)
PB_DS_THROW_IF_FAILED(rhs.empty(), rhs.size(), m_p_c, &m_native_c);
m_p_c->swap(lhs);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
PB_DS_THROW_IF_FAILED(container_traits::split_join_can_throw,
......
......@@ -66,7 +66,7 @@ default_constructor()
{
m_p_c = new Cntnr;
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -110,7 +110,7 @@ copy_constructor()
p_c = new Cntnr(*m_p_c);
std::swap(p_c, m_p_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -139,7 +139,7 @@ assignment_operator()
*p_c = *m_p_c;
std::swap(p_c, m_p_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -180,7 +180,7 @@ it_constructor()
std::swap(p_c, m_p_c);
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -433,7 +433,7 @@ push()
_GLIBCXX_THROW_IF(sz != m_p_c->size() - 1, sz, m_p_c, &m_native_c);
m_native_c.push(test_traits::native_value(v));
}
catch(__gnu_cxx::forced_exception_error& )
catch(__gnu_cxx::forced_error&)
{
done = false;
}
......@@ -475,7 +475,7 @@ modify()
m_native_c.modify(native_v, new_native_v);
}
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
_GLIBCXX_THROW_IF(true, "", m_p_c, &m_native_c);
......@@ -517,7 +517,7 @@ pop()
m_native_c.pop();
}
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
_GLIBCXX_THROW_IF(true, "", m_p_c, &m_native_c);
......@@ -560,7 +560,7 @@ erase_if()
_GLIBCXX_THROW_IF(ersd != native_ersd, ersd << " " << native_ersd,
m_p_c, &m_native_c);
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
_GLIBCXX_THROW_IF(true, "", m_p_c, &m_native_c);
......@@ -592,7 +592,7 @@ erase_it()
m_p_c->erase(it);
}
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
_GLIBCXX_THROW_IF(true, "", m_p_c, &m_native_c);
......@@ -715,7 +715,7 @@ split_join()
_GLIBCXX_THROW_IF(rhs.size() != 0, rhs.size(), m_p_c, &m_native_c);
_GLIBCXX_THROW_IF(!rhs.empty(), rhs.size(), m_p_c, &m_native_c);
}
catch(__gnu_cxx::forced_exception_error&)
catch(__gnu_cxx::forced_error&)
{
done = false;
const bool b = __gnu_pbds::container_traits<cntnr>::split_join_can_throw;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment