This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] make -fno-exceptions work again for libsupc++/libstdc++
- To: gcc-patches at gcc dot gnu dot org
- Subject: [v3] make -fno-exceptions work again for libsupc++/libstdc++
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Tue, 23 Oct 2001 18:42:18 -0700
This work has suffered some bit rot. Here are the fixes necessary to
get it working again.
I also took the opportunity to remove some of the __STL_* macros that
I'd been too lazy to completely remove on the first pass of this. They
are now completely removed, and the corresponding c++config.h bits are
gone.
tested x86/linux with and without -fexceptions
-benjamin
2001-10-23 Benjamin Kosnik <bkoz@redhat.com>
Make -fno-exceptions work.
* config/locale/c_locale_gnu.cc: Use functexcept.
* include/bits/c++config (__stl_assert): Remove.
(__STL_USE_EXCEPTIONS): Same.
(__STL_TRY): Same.
(__STL_CATCH_ALL): Same.
(__STL_THROW): Same.
(__STL_RETHROW): Same.
(__STL_NOTHROW): Same.
(__STL_UNWIND): Same.
* include/bits/pthread_allocimpl.h: Fix.
* include/bits/std_bitset.h: Same.
* include/bits/std_list.h: Same.
* include/bits/std_memory.h: Same.
* include/bits/std_queue.h: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/stl_deque.h: Same.
* include/bits/stl_list.h: Same.
* include/bits/stl_queue.h: Same.
* include/bits/stl_tempbuf.h: Same.
* include/bits/stl_tree.h: Same.
* include/bits/stl_uninitialized.h: Same.
* include/bits/stl_vector.h: Same.
* include/ext/ropeimpl.h: Same.
* include/ext/slist: Same.
* include/ext/stl_hashtable.h: Same.
* include/ext/stl_rope.h: Same.
* libsupc++/new_op.cc: Include cstdlib.
* libsupc++/eh_personality.cc: Add exception_defines include. Use
__throw_exception_again, tweak.
* libsupc++/eh_aux_runtime.cc: Include stdlib for abort.
* libsupc++/vec.cc: Tweak.
* src/functexcept.cc: Remove unused arguments.
* testsuite/23_containers/bitset_members.cc: Tweak.
Index: config/locale/c_locale_gnu.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/c_locale_gnu.cc,v
retrieving revision 1.4
diff -c -p -r1.4 c_locale_gnu.cc
*** c_locale_gnu.cc 2001/08/28 06:19:33 1.4
--- c_locale_gnu.cc 2001/10/24 01:38:34
*************** namespace std
*** 50,56 ****
if (!__cloc)
{
// This named locale is not supported by the underlying OS.
! throw runtime_error("attempt to create locale from unknown name");
}
}
--- 50,56 ----
if (!__cloc)
{
// This named locale is not supported by the underlying OS.
! __throw_runtime_error("attempt to create locale from unknown name");
}
}
Index: include/bits/c++config
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/c++config,v
retrieving revision 1.150
diff -c -p -r1.150 c++config
*** c++config 2001/10/23 21:40:30 1.150
--- c++config 2001/10/24 01:38:36
***************
*** 72,97 ****
// internal ABI change).
#define __STL_GTHREADS
#define __STL_THREADS
- #define __STL_VOLATILE volatile
- // This is also a user hook, but via -f[no-]exceptions, not direct #defines.
- #ifdef __EXCEPTIONS
- # define __STL_USE_EXCEPTIONS
- # define __STL_TRY try
- # define __STL_CATCH_ALL catch(...)
- # define __STL_THROW(x) throw x
- # define __STL_RETHROW throw
- # define __STL_NOTHROW throw()
- # define __STL_UNWIND(action) catch(...) { action; throw; }
- #else
- # define __STL_TRY
- # define __STL_CATCH_ALL if (false)
- # define __STL_THROW(x)
- # define __STL_RETHROW
- # define __STL_NOTHROW
- # define __STL_UNWIND(action)
- #endif
-
// Default to the typically high-speed, pool-based allocator (as
// libstdc++-v2) instead of the malloc-based allocator (libstdc++-v3
// snapshots). See libstdc++-v3/docs/html/17_intro/howto.html for
--- 72,78 ----
***************
*** 103,113 ****
// The remainder of the prewritten config is mostly automatic; all the
// user hooks are listed above.
-
- // XXX
- // Only used in the SGI rope extensions; this is from stl_config.h and
- // should be cleaned up.
- # define __stl_assert(expr)
/** @namespace std
* @brief Everything defined by the ISO C++ Standard is within namespace std.
--- 84,89 ----
Index: include/bits/pthread_allocimpl.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/pthread_allocimpl.h,v
retrieving revision 1.7
diff -c -p -r1.7 pthread_allocimpl.h
*** pthread_allocimpl.h 2001/06/27 17:09:52 1.7
--- pthread_allocimpl.h 2001/10/24 01:38:37
*************** public:
*** 422,433 ****
typedef pthread_allocator<_NewType> other;
};
! pthread_allocator() __STL_NOTHROW {}
! pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {}
template <class _OtherType>
pthread_allocator(const pthread_allocator<_OtherType>&)
! __STL_NOTHROW {}
! ~pthread_allocator() __STL_NOTHROW {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
--- 422,433 ----
typedef pthread_allocator<_NewType> other;
};
! pthread_allocator() throw() {}
! pthread_allocator(const pthread_allocator& a) throw() {}
template <class _OtherType>
pthread_allocator(const pthread_allocator<_OtherType>&)
! throw() {}
! ~pthread_allocator() throw() {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
*************** public:
*** 443,449 ****
void deallocate(pointer __p, size_type __n)
{ _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
! size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
--- 443,449 ----
void deallocate(pointer __p, size_type __n)
{ _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
! size_type max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
Index: include/bits/std_bitset.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_bitset.h,v
retrieving revision 1.12
diff -c -p -r1.12 std_bitset.h
*** std_bitset.h 2001/09/25 23:51:17 1.12
--- std_bitset.h 2001/10/24 01:38:39
***************
*** 59,67 ****
#include <bits/std_cstddef.h> // for size_t
#include <bits/std_cstring.h> // for memset
#include <bits/std_string.h>
! #include <bits/std_stdexcept.h> // for invalid_argument, out_of_range,
! // overflow_error
!
#include <bits/std_ostream.h> // for ostream (operator<<)
#include <bits/std_istream.h> // for istream (operator>>)
--- 59,67 ----
#include <bits/std_cstddef.h> // for size_t
#include <bits/std_cstring.h> // for memset
#include <bits/std_string.h>
! #include <bits/std_stdexcept.h>
! #include <bits/functexcept.h> // for invalid_argument, out_of_range,
! // overflow_error
#include <bits/std_ostream.h> // for ostream (operator<<)
#include <bits/std_istream.h> // for istream (operator>>)
*************** unsigned long _Base_bitset<_Nw>::_M_do_t
*** 244,250 ****
{
for (size_t __i = 1; __i < _Nw; ++__i)
if (_M_w[__i])
! __STL_THROW(overflow_error("bitset"));
return _M_w[0];
}
--- 244,250 ----
{
for (size_t __i = 1; __i < _Nw; ++__i)
if (_M_w[__i])
! __throw_overflow_error("bitset");
return _M_w[0];
}
*************** public:
*** 490,496 ****
: _Base()
{
if (__pos > __s.size())
! __STL_THROW(out_of_range("bitset"));
_M_copy_from_string(__s, __pos,
basic_string<_CharT, _Traits, _Alloc>::npos);
}
--- 490,496 ----
: _Base()
{
if (__pos > __s.size())
! __throw_out_of_range("bitset");
_M_copy_from_string(__s, __pos,
basic_string<_CharT, _Traits, _Alloc>::npos);
}
*************** public:
*** 501,507 ****
: _Base()
{
if (__pos > __s.size())
! __STL_THROW(out_of_range("bitset"));
_M_copy_from_string(__s, __pos, __n);
}
--- 501,507 ----
: _Base()
{
if (__pos > __s.size())
! __throw_out_of_range("bitset");
_M_copy_from_string(__s, __pos, __n);
}
*************** public:
*** 577,583 ****
bitset<_Nb>& set(size_t __pos, bool __val = true) {
if (__pos >= _Nb)
! __STL_THROW(out_of_range("bitset"));
return _Unchecked_set(__pos, __val);
}
--- 577,583 ----
bitset<_Nb>& set(size_t __pos, bool __val = true) {
if (__pos >= _Nb)
! __throw_out_of_range("bitset");
return _Unchecked_set(__pos, __val);
}
*************** public:
*** 589,595 ****
bitset<_Nb>& reset(size_t __pos) {
if (__pos >= _Nb)
! __STL_THROW(out_of_range("bitset"));
return _Unchecked_reset(__pos);
}
--- 589,595 ----
bitset<_Nb>& reset(size_t __pos) {
if (__pos >= _Nb)
! __throw_out_of_range("bitset");
return _Unchecked_reset(__pos);
}
*************** public:
*** 602,608 ****
bitset<_Nb>& flip(size_t __pos) {
if (__pos >= _Nb)
! __STL_THROW(out_of_range("bitset"));
return _Unchecked_flip(__pos);
}
--- 602,608 ----
bitset<_Nb>& flip(size_t __pos) {
if (__pos >= _Nb)
! __throw_out_of_range("bitset");
return _Unchecked_flip(__pos);
}
*************** public:
*** 650,656 ****
bool test(size_t __pos) const {
if (__pos >= _Nb)
! __STL_THROW(out_of_range("bitset"));
return _Unchecked_test(__pos);
}
--- 650,656 ----
bool test(size_t __pos) const {
if (__pos >= _Nb)
! __throw_out_of_range("bitset");
return _Unchecked_test(__pos);
}
*************** void bitset<_Nb>
*** 700,706 ****
set(__i);
break;
default:
! __STL_THROW(invalid_argument("bitset"));
}
}
}
--- 700,706 ----
set(__i);
break;
default:
! __throw_invalid_argument("bitset");
}
}
}
Index: include/bits/std_list.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_list.h,v
retrieving revision 1.5
diff -c -p -r1.5 std_list.h
*** std_list.h 2001/06/27 17:09:52 1.5
--- std_list.h 2001/10/24 01:38:39
***************
*** 58,63 ****
--- 58,64 ----
#pragma GCC system_header
+ #include <bits/functexcept.h>
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
Index: include/bits/std_memory.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_memory.h,v
retrieving revision 1.7
diff -c -p -r1.7 std_memory.h
*** std_memory.h 2001/06/27 17:09:52 1.7
--- std_memory.h 2001/10/24 01:38:39
*************** private:
*** 69,87 ****
public:
typedef _Tp element_type;
! explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
! auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
! template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
: _M_ptr(__a.release()) {}
! auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
reset(__a.release());
return *this;
}
template <class _Tp1>
! auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
reset(__a.release());
return *this;
}
--- 69,87 ----
public:
typedef _Tp element_type;
! explicit auto_ptr(_Tp* __p = 0) throw() : _M_ptr(__p) {}
! auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) {}
! template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) throw()
: _M_ptr(__a.release()) {}
! auto_ptr& operator=(auto_ptr& __a) throw() {
reset(__a.release());
return *this;
}
template <class _Tp1>
! auto_ptr& operator=(auto_ptr<_Tp1>& __a) throw() {
reset(__a.release());
return *this;
}
*************** public:
*** 92,112 ****
// this is prohibited.
~auto_ptr() { delete _M_ptr; }
! _Tp& operator*() const __STL_NOTHROW {
return *_M_ptr;
}
! _Tp* operator->() const __STL_NOTHROW {
return _M_ptr;
}
! _Tp* get() const __STL_NOTHROW {
return _M_ptr;
}
! _Tp* release() __STL_NOTHROW {
_Tp* __tmp = _M_ptr;
_M_ptr = 0;
return __tmp;
}
! void reset(_Tp* __p = 0) __STL_NOTHROW {
if (__p != _M_ptr) {
delete _M_ptr;
_M_ptr = __p;
--- 92,112 ----
// this is prohibited.
~auto_ptr() { delete _M_ptr; }
! _Tp& operator*() const throw() {
return *_M_ptr;
}
! _Tp* operator->() const throw() {
return _M_ptr;
}
! _Tp* get() const throw() {
return _M_ptr;
}
! _Tp* release() throw() {
_Tp* __tmp = _M_ptr;
_M_ptr = 0;
return __tmp;
}
! void reset(_Tp* __p = 0) throw() {
if (__p != _M_ptr) {
delete _M_ptr;
_M_ptr = __p;
*************** public:
*** 118,127 ****
// in fact, most present-day compilers do not support the language
// features that these conversions rely on.
public:
! auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
: _M_ptr(__ref._M_ptr) {}
! auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW {
if (__ref._M_ptr != this->get()) {
delete _M_ptr;
_M_ptr = __ref._M_ptr;
--- 118,127 ----
// in fact, most present-day compilers do not support the language
// features that these conversions rely on.
public:
! auto_ptr(auto_ptr_ref<_Tp> __ref) throw()
: _M_ptr(__ref._M_ptr) {}
! auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) throw() {
if (__ref._M_ptr != this->get()) {
delete _M_ptr;
_M_ptr = __ref._M_ptr;
*************** public:
*** 129,137 ****
return *this;
}
! template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
{ return auto_ptr_ref<_Tp>(this->release()); }
! template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
{ return auto_ptr<_Tp1>(this->release()); }
};
--- 129,137 ----
return *this;
}
! template <class _Tp1> operator auto_ptr_ref<_Tp1>() throw()
{ return auto_ptr_ref<_Tp>(this->release()); }
! template <class _Tp1> operator auto_ptr<_Tp1>() throw()
{ return auto_ptr<_Tp1>(this->release()); }
};
Index: include/bits/std_queue.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_queue.h,v
retrieving revision 1.7
diff -c -p -r1.7 std_queue.h
*** std_queue.h 2001/06/27 17:09:52 1.7
--- std_queue.h 2001/10/24 01:38:39
***************
*** 58,63 ****
--- 58,64 ----
#pragma GCC system_header
#include <bits/c++config.h>
+ #include <bits/functexcept.h>
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
Index: include/bits/stl_alloc.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_alloc.h,v
retrieving revision 1.7
diff -c -p -r1.7 stl_alloc.h
*** stl_alloc.h 2001/06/27 17:09:52 1.7
--- stl_alloc.h 2001/10/24 01:38:42
*************** private:
*** 306,312 ****
char _M_client_data[1]; /* The client sees this. */
};
! static _Obj* __STL_VOLATILE _S_free_list[];
// Specifying a size results in duplicate def for 4.1
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1);
--- 306,312 ----
char _M_client_data[1]; /* The client sees this. */
};
! static _Obj* volatile _S_free_list[];
// Specifying a size results in duplicate def for 4.1
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1);
*************** public:
*** 349,355 ****
__ret = __mem_interface::allocate(__n);
else
{
! _Obj* __STL_VOLATILE* __my_free_list = _S_free_list + _S_freelist_index(__n);
// Acquire the lock here with a constructor call.
// This ensures that it is released in exit or during stack
// unwinding.
--- 349,355 ----
__ret = __mem_interface::allocate(__n);
else
{
! _Obj* volatile* __my_free_list = _S_free_list + _S_freelist_index(__n);
// Acquire the lock here with a constructor call.
// This ensures that it is released in exit or during stack
// unwinding.
*************** public:
*** 377,383 ****
__mem_interface::deallocate(__p, __n);
else
{
! _Obj* __STL_VOLATILE* __my_free_list
= _S_free_list + _S_freelist_index(__n);
_Obj* __q = (_Obj*)__p;
--- 377,383 ----
__mem_interface::deallocate(__p, __n);
else
{
! _Obj* volatile* __my_free_list
= _S_free_list + _S_freelist_index(__n);
_Obj* __q = (_Obj*)__p;
*************** __default_alloc_template<__threads, __in
*** 448,454 ****
// Try to make use of the left-over piece.
if (__bytes_left > 0)
{
! _Obj* __STL_VOLATILE* __my_free_list =
_S_free_list + _S_freelist_index(__bytes_left);
((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
--- 448,454 ----
// Try to make use of the left-over piece.
if (__bytes_left > 0)
{
! _Obj* volatile* __my_free_list =
_S_free_list + _S_freelist_index(__bytes_left);
((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
*************** __default_alloc_template<__threads, __in
*** 458,464 ****
if (0 == _S_start_free)
{
size_t __i;
! _Obj* __STL_VOLATILE* __my_free_list;
_Obj* __p;
// Try to make do with what we have. That can't hurt. We
// do not try smaller requests, since that tends to result
--- 458,464 ----
if (0 == _S_start_free)
{
size_t __i;
! _Obj* volatile* __my_free_list;
_Obj* __p;
// Try to make do with what we have. That can't hurt. We
// do not try smaller requests, since that tends to result
*************** __default_alloc_template<__threads, __in
*** 500,506 ****
{
int __nobjs = 20;
char* __chunk = _S_chunk_alloc(__n, __nobjs);
! _Obj* __STL_VOLATILE* __my_free_list;
_Obj* __result;
_Obj* __current_obj;
_Obj* __next_obj;
--- 500,506 ----
{
int __nobjs = 20;
char* __chunk = _S_chunk_alloc(__n, __nobjs);
! _Obj* volatile* __my_free_list;
_Obj* __result;
_Obj* __current_obj;
_Obj* __next_obj;
*************** template <bool __threads, int __inst>
*** 563,569 ****
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
template <bool __threads, int __inst>
! typename __default_alloc_template<__threads, __inst>::_Obj* __STL_VOLATILE
__default_alloc_template<__threads, __inst> ::_S_free_list[
__default_alloc_template<__threads, __inst>::_NFREELISTS
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
--- 563,569 ----
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
template <bool __threads, int __inst>
! typename __default_alloc_template<__threads, __inst>::_Obj* volatile
__default_alloc_template<__threads, __inst> ::_S_free_list[
__default_alloc_template<__threads, __inst>::_NFREELISTS
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
*************** public:
*** 597,606 ****
typedef allocator<_Tp1> other;
};
! allocator() __STL_NOTHROW {}
! allocator(const allocator&) __STL_NOTHROW {}
! template <class _Tp1> allocator(const allocator<_Tp1>&) __STL_NOTHROW {}
! ~allocator() __STL_NOTHROW {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
--- 597,606 ----
typedef allocator<_Tp1> other;
};
! allocator() throw() {}
! allocator(const allocator&) throw() {}
! template <class _Tp1> allocator(const allocator<_Tp1>&) throw() {}
! ~allocator() throw() {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
*************** public:
*** 616,622 ****
void deallocate(pointer __p, size_type __n)
{ _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
! size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
--- 616,622 ----
void deallocate(pointer __p, size_type __n)
{ _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
! size_type max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
*************** struct __allocator {
*** 673,685 ****
typedef __allocator<_Tp1, _Alloc> other;
};
! __allocator() __STL_NOTHROW {}
! __allocator(const __allocator& __a) __STL_NOTHROW
: __underlying_alloc(__a.__underlying_alloc) {}
template <class _Tp1>
! __allocator(const __allocator<_Tp1, _Alloc>& __a) __STL_NOTHROW
: __underlying_alloc(__a.__underlying_alloc) {}
! ~__allocator() __STL_NOTHROW {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
--- 673,685 ----
typedef __allocator<_Tp1, _Alloc> other;
};
! __allocator() throw() {}
! __allocator(const __allocator& __a) throw()
: __underlying_alloc(__a.__underlying_alloc) {}
template <class _Tp1>
! __allocator(const __allocator<_Tp1, _Alloc>& __a) throw()
: __underlying_alloc(__a.__underlying_alloc) {}
! ~__allocator() throw() {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
*************** struct __allocator {
*** 695,701 ****
void deallocate(pointer __p, size_type __n)
{ __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
! size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
--- 695,701 ----
void deallocate(pointer __p, size_type __n)
{ __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
! size_type max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
Index: include/bits/stl_deque.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_deque.h,v
retrieving revision 1.9
diff -c -p -r1.9 stl_deque.h
*** stl_deque.h 2001/07/02 19:47:09 1.9
--- stl_deque.h 2001/10/24 01:38:45
***************
*** 100,114 ****
namespace std
{
! // Note: this function is simply a kludge to work around several compilers'
! // bugs in handling constant expressions.
! inline size_t __deque_buf_size(size_t __size) {
! return __size < 512 ? size_t(512 / __size) : size_t(1);
! }
!
! template <class _Tp, class _Ref, class _Ptr>
! struct _Deque_iterator {
typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); }
--- 100,113 ----
namespace std
{
+ // Note: this function is simply a kludge to work around several compilers'
+ // bugs in handling constant expressions.
+ inline size_t
+ __deque_buf_size(size_t __size)
+ { return __size < 512 ? size_t(512 / __size) : size_t(1); }
! template <class _Tp, class _Ref, class _Ptr>
! struct _Deque_iterator {
typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); }
*************** _Deque_base<_Tp,_Alloc>::_M_initialize_m
*** 351,361 ****
_Tp** __nstart = _M_map + (_M_map_size - __num_nodes) / 2;
_Tp** __nfinish = __nstart + __num_nodes;
! __STL_TRY {
! _M_create_nodes(__nstart, __nfinish);
! }
! __STL_UNWIND((_M_deallocate_map(_M_map, _M_map_size),
! _M_map = 0, _M_map_size = 0));
_M_start._M_set_node(__nstart);
_M_finish._M_set_node(__nfinish - 1);
_M_start._M_cur = _M_start._M_first;
--- 350,365 ----
_Tp** __nstart = _M_map + (_M_map_size - __num_nodes) / 2;
_Tp** __nfinish = __nstart + __num_nodes;
! try
! { _M_create_nodes(__nstart, __nfinish); }
! catch(...)
! {
! _M_deallocate_map(_M_map, _M_map_size);
! _M_map = 0;
! _M_map_size = 0;
! __throw_exception_again;
! }
!
_M_start._M_set_node(__nstart);
_M_finish._M_set_node(__nfinish - 1);
_M_start._M_cur = _M_start._M_first;
*************** template <class _Tp, class _Alloc>
*** 367,377 ****
void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish)
{
_Tp** __cur;
! __STL_TRY {
for (__cur = __nstart; __cur < __nfinish; ++__cur)
*__cur = _M_allocate_node();
}
! __STL_UNWIND(_M_destroy_nodes(__nstart, __cur));
}
template <class _Tp, class _Alloc>
--- 371,385 ----
void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish)
{
_Tp** __cur;
! try {
for (__cur = __nstart; __cur < __nfinish; ++__cur)
*__cur = _M_allocate_node();
}
! catch(...)
! {
! _M_destroy_nodes(__nstart, __cur);
! __throw_exception_again;
! }
}
template <class _Tp, class _Alloc>
*************** void deque<_Tp, _Alloc>::_M_fill_insert(
*** 850,869 ****
{
if (__pos._M_cur == _M_start._M_cur) {
iterator __new_start = _M_reserve_elements_at_front(__n);
! __STL_TRY {
uninitialized_fill(__new_start, _M_start, __x);
_M_start = __new_start;
}
! __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
}
else if (__pos._M_cur == _M_finish._M_cur) {
iterator __new_finish = _M_reserve_elements_at_back(__n);
! __STL_TRY {
uninitialized_fill(_M_finish, __new_finish, __x);
_M_finish = __new_finish;
}
! __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
! __new_finish._M_node + 1));
}
else
_M_insert_aux(__pos, __n, __x);
--- 858,884 ----
{
if (__pos._M_cur == _M_start._M_cur) {
iterator __new_start = _M_reserve_elements_at_front(__n);
! try {
uninitialized_fill(__new_start, _M_start, __x);
_M_start = __new_start;
}
! catch(...)
! {
! _M_destroy_nodes(__new_start._M_node, _M_start._M_node);
! __throw_exception_again;
! }
}
else if (__pos._M_cur == _M_finish._M_cur) {
iterator __new_finish = _M_reserve_elements_at_back(__n);
! try {
uninitialized_fill(_M_finish, __new_finish, __x);
_M_finish = __new_finish;
}
! catch(...)
! {
! _M_destroy_nodes(_M_finish._M_node + 1, __new_finish._M_node + 1);
! __throw_exception_again;
! }
}
else
_M_insert_aux(__pos, __n, __x);
*************** void deque<_Tp,_Alloc>::clear()
*** 924,935 ****
template <class _Tp, class _Alloc>
void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __value) {
_Map_pointer __cur;
! __STL_TRY {
for (__cur = _M_start._M_node; __cur < _M_finish._M_node; ++__cur)
uninitialized_fill(*__cur, *__cur + _S_buffer_size(), __value);
uninitialized_fill(_M_finish._M_first, _M_finish._M_cur, __value);
}
! __STL_UNWIND(_Destroy(_M_start, iterator(*__cur, __cur)));
}
template <class _Tp, class _Alloc> template <class _InputIterator>
--- 939,954 ----
template <class _Tp, class _Alloc>
void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __value) {
_Map_pointer __cur;
! try {
for (__cur = _M_start._M_node; __cur < _M_finish._M_node; ++__cur)
uninitialized_fill(*__cur, *__cur + _S_buffer_size(), __value);
uninitialized_fill(_M_finish._M_first, _M_finish._M_cur, __value);
}
! catch(...)
! {
! _Destroy(_M_start, iterator(*__cur, __cur));
! __throw_exception_again;
! }
}
template <class _Tp, class _Alloc> template <class _InputIterator>
*************** void deque<_Tp,_Alloc>::_M_range_initial
*** 938,948 ****
input_iterator_tag)
{
_M_initialize_map(0);
! __STL_TRY {
for ( ; __first != __last; ++__first)
push_back(*__first);
}
! __STL_UNWIND(clear());
}
template <class _Tp, class _Alloc> template <class _ForwardIterator>
--- 957,971 ----
input_iterator_tag)
{
_M_initialize_map(0);
! try {
for ( ; __first != __last; ++__first)
push_back(*__first);
}
! catch(...)
! {
! clear();
! __throw_exception_again;
! }
}
template <class _Tp, class _Alloc> template <class _ForwardIterator>
*************** void deque<_Tp,_Alloc>::_M_range_initial
*** 955,961 ****
_M_initialize_map(__n);
_Map_pointer __cur_node;
! __STL_TRY {
for (__cur_node = _M_start._M_node;
__cur_node < _M_finish._M_node;
++__cur_node) {
--- 978,984 ----
_M_initialize_map(__n);
_Map_pointer __cur_node;
! try {
for (__cur_node = _M_start._M_node;
__cur_node < _M_finish._M_node;
++__cur_node) {
*************** void deque<_Tp,_Alloc>::_M_range_initial
*** 966,972 ****
}
uninitialized_copy(__first, __last, _M_finish._M_first);
}
! __STL_UNWIND(_Destroy(_M_start, iterator(*__cur_node, __cur_node)));
}
// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
--- 989,999 ----
}
uninitialized_copy(__first, __last, _M_finish._M_first);
}
! catch(...)
! {
! _Destroy(_M_start, iterator(*__cur_node, __cur_node));
! __throw_exception_again;
! }
}
// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
*************** deque<_Tp,_Alloc>::_M_push_back_aux(cons
*** 977,988 ****
value_type __t_copy = __t;
_M_reserve_map_at_back();
*(_M_finish._M_node + 1) = _M_allocate_node();
! __STL_TRY {
_Construct(_M_finish._M_cur, __t_copy);
_M_finish._M_set_node(_M_finish._M_node + 1);
_M_finish._M_cur = _M_finish._M_first;
}
! __STL_UNWIND(_M_deallocate_node(*(_M_finish._M_node + 1)));
}
// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
--- 1004,1019 ----
value_type __t_copy = __t;
_M_reserve_map_at_back();
*(_M_finish._M_node + 1) = _M_allocate_node();
! try {
_Construct(_M_finish._M_cur, __t_copy);
_M_finish._M_set_node(_M_finish._M_node + 1);
_M_finish._M_cur = _M_finish._M_first;
}
! catch(...)
! {
! _M_deallocate_node(*(_M_finish._M_node + 1));
! __throw_exception_again;
! }
}
// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
*************** deque<_Tp,_Alloc>::_M_push_back_aux()
*** 992,1003 ****
{
_M_reserve_map_at_back();
*(_M_finish._M_node + 1) = _M_allocate_node();
! __STL_TRY {
_Construct(_M_finish._M_cur);
_M_finish._M_set_node(_M_finish._M_node + 1);
_M_finish._M_cur = _M_finish._M_first;
}
! __STL_UNWIND(_M_deallocate_node(*(_M_finish._M_node + 1)));
}
// Called only if _M_start._M_cur == _M_start._M_first.
--- 1023,1038 ----
{
_M_reserve_map_at_back();
*(_M_finish._M_node + 1) = _M_allocate_node();
! try {
_Construct(_M_finish._M_cur);
_M_finish._M_set_node(_M_finish._M_node + 1);
_M_finish._M_cur = _M_finish._M_first;
}
! catch(...)
! {
! _M_deallocate_node(*(_M_finish._M_node + 1));
! __throw_exception_again;
! }
}
// Called only if _M_start._M_cur == _M_start._M_first.
*************** deque<_Tp,_Alloc>::_M_push_front_aux(con
*** 1008,1019 ****
value_type __t_copy = __t;
_M_reserve_map_at_front();
*(_M_start._M_node - 1) = _M_allocate_node();
! __STL_TRY {
_M_start._M_set_node(_M_start._M_node - 1);
_M_start._M_cur = _M_start._M_last - 1;
_Construct(_M_start._M_cur, __t_copy);
}
! __STL_UNWIND((++_M_start, _M_deallocate_node(*(_M_start._M_node - 1))));
}
// Called only if _M_start._M_cur == _M_start._M_first.
--- 1043,1059 ----
value_type __t_copy = __t;
_M_reserve_map_at_front();
*(_M_start._M_node - 1) = _M_allocate_node();
! try {
_M_start._M_set_node(_M_start._M_node - 1);
_M_start._M_cur = _M_start._M_last - 1;
_Construct(_M_start._M_cur, __t_copy);
}
! catch(...)
! {
! ++_M_start;
! _M_deallocate_node(*(_M_start._M_node - 1));
! __throw_exception_again;
! }
}
// Called only if _M_start._M_cur == _M_start._M_first.
*************** deque<_Tp,_Alloc>::_M_push_front_aux()
*** 1023,1034 ****
{
_M_reserve_map_at_front();
*(_M_start._M_node - 1) = _M_allocate_node();
! __STL_TRY {
_M_start._M_set_node(_M_start._M_node - 1);
_M_start._M_cur = _M_start._M_last - 1;
_Construct(_M_start._M_cur);
}
! __STL_UNWIND((++_M_start, _M_deallocate_node(*(_M_start._M_node - 1))));
}
// Called only if _M_finish._M_cur == _M_finish._M_first.
--- 1063,1079 ----
{
_M_reserve_map_at_front();
*(_M_start._M_node - 1) = _M_allocate_node();
! try {
_M_start._M_set_node(_M_start._M_node - 1);
_M_start._M_cur = _M_start._M_last - 1;
_Construct(_M_start._M_cur);
}
! catch(...)
! {
! ++_M_start;
! _M_deallocate_node(*(_M_start._M_node - 1));
! __throw_exception_again;
! }
}
// Called only if _M_finish._M_cur == _M_finish._M_first.
*************** deque<_Tp,_Alloc>::insert(iterator __pos
*** 1071,1090 ****
distance(__first, __last, __n);
if (__pos._M_cur == _M_start._M_cur) {
iterator __new_start = _M_reserve_elements_at_front(__n);
! __STL_TRY {
uninitialized_copy(__first, __last, __new_start);
_M_start = __new_start;
}
! __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
}
else if (__pos._M_cur == _M_finish._M_cur) {
iterator __new_finish = _M_reserve_elements_at_back(__n);
! __STL_TRY {
uninitialized_copy(__first, __last, _M_finish);
_M_finish = __new_finish;
}
! __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
! __new_finish._M_node + 1));
}
else
_M_insert_aux(__pos, __first, __last, __n);
--- 1116,1142 ----
distance(__first, __last, __n);
if (__pos._M_cur == _M_start._M_cur) {
iterator __new_start = _M_reserve_elements_at_front(__n);
! try {
uninitialized_copy(__first, __last, __new_start);
_M_start = __new_start;
}
! catch(...)
! {
! _M_destroy_nodes(__new_start._M_node, _M_start._M_node);
! __throw_exception_again;
! }
}
else if (__pos._M_cur == _M_finish._M_cur) {
iterator __new_finish = _M_reserve_elements_at_back(__n);
! try {
uninitialized_copy(__first, __last, _M_finish);
_M_finish = __new_finish;
}
! catch(...)
! {
! _M_destroy_nodes(_M_finish._M_node + 1, __new_finish._M_node + 1);
! __throw_exception_again;
! }
}
else
_M_insert_aux(__pos, __first, __last, __n);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1161,1167 ****
iterator __new_start = _M_reserve_elements_at_front(__n);
iterator __old_start = _M_start;
__pos = _M_start + __elems_before;
! __STL_TRY {
if (__elems_before >= difference_type(__n)) {
iterator __start_n = _M_start + difference_type(__n);
uninitialized_copy(_M_start, __start_n, __new_start);
--- 1213,1219 ----
iterator __new_start = _M_reserve_elements_at_front(__n);
iterator __old_start = _M_start;
__pos = _M_start + __elems_before;
! try {
if (__elems_before >= difference_type(__n)) {
iterator __start_n = _M_start + difference_type(__n);
uninitialized_copy(_M_start, __start_n, __new_start);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1176,1182 ****
fill(__old_start, __pos, __x_copy);
}
}
! __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
}
else {
iterator __new_finish = _M_reserve_elements_at_back(__n);
--- 1228,1238 ----
fill(__old_start, __pos, __x_copy);
}
}
! catch(...)
! {
! _M_destroy_nodes(__new_start._M_node, _M_start._M_node);
! __throw_exception_again;
! }
}
else {
iterator __new_finish = _M_reserve_elements_at_back(__n);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1184,1190 ****
const difference_type __elems_after =
difference_type(__length) - __elems_before;
__pos = _M_finish - __elems_after;
! __STL_TRY {
if (__elems_after > difference_type(__n)) {
iterator __finish_n = _M_finish - difference_type(__n);
uninitialized_copy(__finish_n, _M_finish, _M_finish);
--- 1240,1246 ----
const difference_type __elems_after =
difference_type(__length) - __elems_before;
__pos = _M_finish - __elems_after;
! try {
if (__elems_after > difference_type(__n)) {
iterator __finish_n = _M_finish - difference_type(__n);
uninitialized_copy(__finish_n, _M_finish, _M_finish);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1199,1206 ****
fill(__pos, __old_finish, __x_copy);
}
}
! __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
! __new_finish._M_node + 1));
}
}
--- 1255,1265 ----
fill(__pos, __old_finish, __x_copy);
}
}
! catch(...)
! {
! _M_destroy_nodes(_M_finish._M_node + 1, __new_finish._M_node + 1);
! __throw_exception_again;
! }
}
}
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1216,1222 ****
iterator __new_start = _M_reserve_elements_at_front(__n);
iterator __old_start = _M_start;
__pos = _M_start + __elemsbefore;
! __STL_TRY {
if (__elemsbefore >= difference_type(__n)) {
iterator __start_n = _M_start + difference_type(__n);
uninitialized_copy(_M_start, __start_n, __new_start);
--- 1275,1281 ----
iterator __new_start = _M_reserve_elements_at_front(__n);
iterator __old_start = _M_start;
__pos = _M_start + __elemsbefore;
! try {
if (__elemsbefore >= difference_type(__n)) {
iterator __start_n = _M_start + difference_type(__n);
uninitialized_copy(_M_start, __start_n, __new_start);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1233,1239 ****
copy(__mid, __last, __old_start);
}
}
! __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
}
else {
iterator __new_finish = _M_reserve_elements_at_back(__n);
--- 1292,1302 ----
copy(__mid, __last, __old_start);
}
}
! catch(...)
! {
! _M_destroy_nodes(__new_start._M_node, _M_start._M_node);
! __throw_exception_again;
! }
}
else {
iterator __new_finish = _M_reserve_elements_at_back(__n);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1241,1247 ****
const difference_type __elemsafter =
difference_type(__length) - __elemsbefore;
__pos = _M_finish - __elemsafter;
! __STL_TRY {
if (__elemsafter > difference_type(__n)) {
iterator __finish_n = _M_finish - difference_type(__n);
uninitialized_copy(__finish_n, _M_finish, _M_finish);
--- 1304,1310 ----
const difference_type __elemsafter =
difference_type(__length) - __elemsbefore;
__pos = _M_finish - __elemsafter;
! try {
if (__elemsafter > difference_type(__n)) {
iterator __finish_n = _M_finish - difference_type(__n);
uninitialized_copy(__finish_n, _M_finish, _M_finish);
*************** void deque<_Tp,_Alloc>::_M_insert_aux(it
*** 1257,1264 ****
copy(__first, __mid, __pos);
}
}
! __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
! __new_finish._M_node + 1));
}
}
--- 1320,1330 ----
copy(__first, __mid, __pos);
}
}
! catch(...)
! {
! _M_destroy_nodes(_M_finish._M_node + 1, __new_finish._M_node + 1);
! __throw_exception_again;
! }
}
}
*************** void deque<_Tp,_Alloc>::_M_new_elements_
*** 1269,1285 ****
= (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
_M_reserve_map_at_front(__new_nodes);
size_type __i;
! __STL_TRY {
for (__i = 1; __i <= __new_nodes; ++__i)
*(_M_start._M_node - __i) = _M_allocate_node();
}
- # ifdef __STL_USE_EXCEPTIONS
catch(...) {
for (size_type __j = 1; __j < __i; ++__j)
_M_deallocate_node(*(_M_start._M_node - __j));
throw;
}
- # endif /* __STL_USE_EXCEPTIONS */
}
template <class _Tp, class _Alloc>
--- 1335,1349 ----
= (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
_M_reserve_map_at_front(__new_nodes);
size_type __i;
! try {
for (__i = 1; __i <= __new_nodes; ++__i)
*(_M_start._M_node - __i) = _M_allocate_node();
}
catch(...) {
for (size_type __j = 1; __j < __i; ++__j)
_M_deallocate_node(*(_M_start._M_node - __j));
throw;
}
}
template <class _Tp, class _Alloc>
*************** void deque<_Tp,_Alloc>::_M_new_elements_
*** 1289,1305 ****
= (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
_M_reserve_map_at_back(__new_nodes);
size_type __i;
! __STL_TRY {
for (__i = 1; __i <= __new_nodes; ++__i)
*(_M_finish._M_node + __i) = _M_allocate_node();
}
- # ifdef __STL_USE_EXCEPTIONS
catch(...) {
for (size_type __j = 1; __j < __i; ++__j)
_M_deallocate_node(*(_M_finish._M_node + __j));
throw;
}
- # endif /* __STL_USE_EXCEPTIONS */
}
template <class _Tp, class _Alloc>
--- 1353,1367 ----
= (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
_M_reserve_map_at_back(__new_nodes);
size_type __i;
! try {
for (__i = 1; __i <= __new_nodes; ++__i)
*(_M_finish._M_node + __i) = _M_allocate_node();
}
catch(...) {
for (size_type __j = 1; __j < __i; ++__j)
_M_deallocate_node(*(_M_finish._M_node + __j));
throw;
}
}
template <class _Tp, class _Alloc>
Index: include/bits/stl_list.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_list.h,v
retrieving revision 1.7
diff -c -p -r1.7 stl_list.h
*** stl_list.h 2001/06/27 17:09:52 1.7
--- stl_list.h 2001/10/24 01:38:47
*************** protected:
*** 265,284 ****
_Node* _M_create_node(const _Tp& __x)
{
_Node* __p = _M_get_node();
! __STL_TRY {
_Construct(&__p->_M_data, __x);
}
! __STL_UNWIND(_M_put_node(__p));
return __p;
}
_Node* _M_create_node()
{
_Node* __p = _M_get_node();
! __STL_TRY {
_Construct(&__p->_M_data);
}
! __STL_UNWIND(_M_put_node(__p));
return __p;
}
--- 265,292 ----
_Node* _M_create_node(const _Tp& __x)
{
_Node* __p = _M_get_node();
! try {
_Construct(&__p->_M_data, __x);
}
! catch(...)
! {
! _M_put_node(__p);
! __throw_exception_again;
! }
return __p;
}
_Node* _M_create_node()
{
_Node* __p = _M_get_node();
! try {
_Construct(&__p->_M_data);
}
! catch(...)
! {
! _M_put_node(__p);
! __throw_exception_again;
! }
return __p;
}
Index: include/bits/stl_queue.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_queue.h,v
retrieving revision 1.8
diff -c -p -r1.8 stl_queue.h
*** stl_queue.h 2001/06/27 17:09:52 1.8
--- stl_queue.h 2001/10/24 01:38:48
*************** public:
*** 200,218 ****
bool empty() const { return c.empty(); }
size_type size() const { return c.size(); }
const_reference top() const { return c.front(); }
! void push(const value_type& __x) {
! __STL_TRY {
! c.push_back(__x);
! push_heap(c.begin(), c.end(), comp);
! }
! __STL_UNWIND(c.clear());
}
! void pop() {
! __STL_TRY {
! pop_heap(c.begin(), c.end(), comp);
! c.pop_back();
! }
! __STL_UNWIND(c.clear());
}
};
--- 200,234 ----
bool empty() const { return c.empty(); }
size_type size() const { return c.size(); }
const_reference top() const { return c.front(); }
!
! void
! push(const value_type& __x)
! {
! try
! {
! c.push_back(__x);
! push_heap(c.begin(), c.end(), comp);
! }
! catch(...)
! {
! c.clear();
! __throw_exception_again;
! }
}
!
! void
! pop()
! {
! try
! {
! pop_heap(c.begin(), c.end(), comp);
! c.pop_back();
! }
! catch(...)
! {
! c.clear();
! __throw_exception_again;
! }
}
};
Index: include/bits/stl_tempbuf.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_tempbuf.h,v
retrieving revision 1.6
diff -c -p -r1.6 stl_tempbuf.h
*** stl_tempbuf.h 2001/07/02 19:47:09 1.6
--- stl_tempbuf.h 2001/10/24 01:38:48
*************** public:
*** 138,151 ****
typedef typename __type_traits<_Tp>::has_trivial_default_constructor
_Trivial;
! __STL_TRY {
_M_len = 0;
distance(__first, __last, _M_len);
_M_allocate_buffer();
if (_M_len > 0)
_M_initialize_buffer(*__first, _Trivial());
}
! __STL_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0);
}
~_Temporary_buffer() {
--- 138,157 ----
typedef typename __type_traits<_Tp>::has_trivial_default_constructor
_Trivial;
! try {
_M_len = 0;
distance(__first, __last, _M_len);
_M_allocate_buffer();
if (_M_len > 0)
_M_initialize_buffer(*__first, _Trivial());
}
! catch(...)
! {
! free(_M_buffer);
! _M_buffer = 0;
! _M_len = 0;
! __throw_exception_again;
! }
}
~_Temporary_buffer() {
Index: include/bits/stl_tree.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_tree.h,v
retrieving revision 1.8
diff -c -p -r1.8 stl_tree.h
*** stl_tree.h 2001/08/24 17:40:31 1.8
--- stl_tree.h 2001/10/24 01:38:52
*************** protected:
*** 556,565 ****
_M_create_node(const value_type& __x)
{
_Link_type __tmp = _M_get_node();
! __STL_TRY {
_Construct(&__tmp->_M_value_field, __x);
}
! __STL_UNWIND(_M_put_node(__tmp));
return __tmp;
}
--- 556,569 ----
_M_create_node(const value_type& __x)
{
_Link_type __tmp = _M_get_node();
! try {
_Construct(&__tmp->_M_value_field, __x);
}
! catch(...)
! {
! _M_put_node(__tmp);
! __throw_exception_again;
! }
return __tmp;
}
*************** _Rb_tree<_Key,_Val,_KoV,_Compare,_Alloc>
*** 1032,1038 ****
_Link_type __top = _M_clone_node(__x);
__top->_M_parent = __p;
! __STL_TRY {
if (__x->_M_right)
__top->_M_right = _M_copy(_S_right(__x), __top);
__p = __top;
--- 1036,1042 ----
_Link_type __top = _M_clone_node(__x);
__top->_M_parent = __p;
! try {
if (__x->_M_right)
__top->_M_right = _M_copy(_S_right(__x), __top);
__p = __top;
*************** _Rb_tree<_Key,_Val,_KoV,_Compare,_Alloc>
*** 1048,1055 ****
__x = _S_left(__x);
}
}
! __STL_UNWIND(_M_erase(__top));
!
return __top;
}
--- 1052,1062 ----
__x = _S_left(__x);
}
}
! catch(...)
! {
! _M_erase(__top);
! __throw_exception_again;
! }
return __top;
}
Index: include/bits/stl_uninitialized.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_uninitialized.h,v
retrieving revision 1.7
diff -c -p -r1.7 stl_uninitialized.h
*** stl_uninitialized.h 2001/07/18 17:08:58 1.7
--- stl_uninitialized.h 2001/10/24 01:38:52
*************** namespace std
*** 81,92 ****
__false_type)
{
_ForwardIter __cur = __result;
! __STL_TRY {
for ( ; __first != __last; ++__first, ++__cur)
_Construct(&*__cur, *__first);
return __cur;
}
! __STL_UNWIND(_Destroy(__result, __cur));
}
template<typename _InputIter, typename _ForwardIter>
--- 81,96 ----
__false_type)
{
_ForwardIter __cur = __result;
! try {
for ( ; __first != __last; ++__first, ++__cur)
_Construct(&*__cur, *__first);
return __cur;
}
! catch(...)
! {
! _Destroy(__result, __cur);
! __throw_exception_again;
! }
}
template<typename _InputIter, typename _ForwardIter>
*************** namespace std
*** 122,133 ****
input_iterator_tag)
{
_ForwardIter __cur = __result;
! __STL_TRY {
for ( ; __count > 0 ; --__count, ++__first, ++__cur)
_Construct(&*__cur, *__first);
return pair<_InputIter, _ForwardIter>(__first, __cur);
}
! __STL_UNWIND(_Destroy(__result, __cur));
}
template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
--- 126,141 ----
input_iterator_tag)
{
_ForwardIter __cur = __result;
! try {
for ( ; __count > 0 ; --__count, ++__first, ++__cur)
_Construct(&*__cur, *__first);
return pair<_InputIter, _ForwardIter>(__first, __cur);
}
! catch(...)
! {
! _Destroy(__result, __cur);
! __throw_exception_again;
! }
}
template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
*************** namespace std
*** 172,182 ****
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
! __STL_TRY {
for ( ; __cur != __last; ++__cur)
_Construct(&*__cur, __x);
}
! __STL_UNWIND(_Destroy(__first, __cur));
}
template<typename _ForwardIter, typename _Tp>
--- 180,194 ----
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
! try {
for ( ; __cur != __last; ++__cur)
_Construct(&*__cur, __x);
}
! catch(...)
! {
! _Destroy(__first, __cur);
! __throw_exception_again;
! }
}
template<typename _ForwardIter, typename _Tp>
*************** namespace std
*** 204,215 ****
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
! __STL_TRY {
for ( ; __n > 0; --__n, ++__cur)
_Construct(&*__cur, __x);
return __cur;
}
! __STL_UNWIND(_Destroy(__first, __cur));
}
template<typename _ForwardIter, typename _Size, typename _Tp>
--- 216,231 ----
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
! try {
for ( ; __n > 0; --__n, ++__cur)
_Construct(&*__cur, __x);
return __cur;
}
! catch(...)
! {
! _Destroy(__first, __cur);
! __throw_exception_again;
! }
}
template<typename _ForwardIter, typename _Size, typename _Tp>
*************** namespace std
*** 236,245 ****
_ForwardIter __result)
{
_ForwardIter __mid = uninitialized_copy(__first1, __last1, __result);
! __STL_TRY {
return uninitialized_copy(__first2, __last2, __mid);
}
! __STL_UNWIND(_Destroy(__result, __mid));
}
// __uninitialized_fill_copy
--- 252,265 ----
_ForwardIter __result)
{
_ForwardIter __mid = uninitialized_copy(__first1, __last1, __result);
! try {
return uninitialized_copy(__first2, __last2, __mid);
}
! catch(...)
! {
! _Destroy(__result, __mid);
! __throw_exception_again;
! }
}
// __uninitialized_fill_copy
*************** namespace std
*** 252,261 ****
_InputIter __first, _InputIter __last)
{
uninitialized_fill(__result, __mid, __x);
! __STL_TRY {
return uninitialized_copy(__first, __last, __mid);
}
! __STL_UNWIND(_Destroy(__result, __mid));
}
// __uninitialized_copy_fill
--- 272,285 ----
_InputIter __first, _InputIter __last)
{
uninitialized_fill(__result, __mid, __x);
! try {
return uninitialized_copy(__first, __last, __mid);
}
! catch(...)
! {
! _Destroy(__result, __mid);
! __throw_exception_again;
! }
}
// __uninitialized_copy_fill
*************** namespace std
*** 268,277 ****
const _Tp& __x)
{
_ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2);
! __STL_TRY {
uninitialized_fill(__mid2, __last2, __x);
}
! __STL_UNWIND(_Destroy(__first2, __mid2));
}
} // namespace std
--- 292,305 ----
const _Tp& __x)
{
_ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2);
! try {
uninitialized_fill(__mid2, __last2, __x);
}
! catch(...)
! {
! _Destroy(__first2, __mid2);
! __throw_exception_again;
! }
}
} // namespace std
Index: include/bits/stl_vector.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_vector.h,v
retrieving revision 1.10
diff -c -p -r1.10 stl_vector.h
*** stl_vector.h 2001/07/06 12:28:48 1.10
--- stl_vector.h 2001/10/24 01:38:54
*************** protected:
*** 437,447 ****
_ForwardIterator __last)
{
pointer __result = _M_allocate(__n);
! __STL_TRY {
uninitialized_copy(__first, __last, __result);
return __result;
}
! __STL_UNWIND(_M_deallocate(__result, __n));
}
template <class _InputIterator>
--- 437,451 ----
_ForwardIterator __last)
{
pointer __result = _M_allocate(__n);
! try {
uninitialized_copy(__first, __last, __result);
return __result;
}
! catch(...)
! {
! _M_deallocate(__result, __n);
! __throw_exception_again;
! }
}
template <class _InputIterator>
*************** vector<_Tp, _Alloc>::_M_insert_aux(itera
*** 617,623 ****
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
iterator __new_start(_M_allocate(__len));
iterator __new_finish(__new_start);
! __STL_TRY {
__new_finish = uninitialized_copy(iterator(_M_start), __position,
__new_start);
_Construct(__new_finish.base(), __x);
--- 621,627 ----
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
iterator __new_start(_M_allocate(__len));
iterator __new_finish(__new_start);
! try {
__new_finish = uninitialized_copy(iterator(_M_start), __position,
__new_start);
_Construct(__new_finish.base(), __x);
*************** vector<_Tp, _Alloc>::_M_insert_aux(itera
*** 625,632 ****
__new_finish = uninitialized_copy(__position, iterator(_M_finish),
__new_finish);
}
! __STL_UNWIND((_Destroy(__new_start,__new_finish),
! _M_deallocate(__new_start.base(),__len)));
_Destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start.base();
--- 629,640 ----
__new_finish = uninitialized_copy(__position, iterator(_M_finish),
__new_finish);
}
! catch(...)
! {
! _Destroy(__new_start,__new_finish);
! _M_deallocate(__new_start.base(),__len);
! __throw_exception_again;
! }
_Destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start.base();
*************** vector<_Tp, _Alloc>::_M_insert_aux(itera
*** 651,657 ****
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
pointer __new_start = _M_allocate(__len);
pointer __new_finish = __new_start;
! __STL_TRY {
__new_finish = uninitialized_copy(iterator(_M_start), __position,
__new_start);
_Construct(__new_finish);
--- 659,665 ----
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
pointer __new_start = _M_allocate(__len);
pointer __new_finish = __new_start;
! try {
__new_finish = uninitialized_copy(iterator(_M_start), __position,
__new_start);
_Construct(__new_finish);
*************** vector<_Tp, _Alloc>::_M_insert_aux(itera
*** 659,666 ****
__new_finish = uninitialized_copy(__position, iterator(_M_finish),
__new_finish);
}
! __STL_UNWIND((_Destroy(__new_start,__new_finish),
! _M_deallocate(__new_start,__len)));
_Destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
--- 667,678 ----
__new_finish = uninitialized_copy(__position, iterator(_M_finish),
__new_finish);
}
! catch(...)
! {
! _Destroy(__new_start,__new_finish);
! _M_deallocate(__new_start,__len);
! __throw_exception_again;
! }
_Destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
*************** void vector<_Tp, _Alloc>::_M_fill_insert
*** 697,710 ****
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start(_M_allocate(__len));
iterator __new_finish(__new_start);
! __STL_TRY {
__new_finish = uninitialized_copy(begin(), __position, __new_start);
__new_finish = uninitialized_fill_n(__new_finish, __n, __x);
__new_finish
= uninitialized_copy(__position, end(), __new_finish);
}
! __STL_UNWIND((_Destroy(__new_start,__new_finish),
! _M_deallocate(__new_start.base(),__len)));
_Destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start.base();
--- 709,726 ----
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start(_M_allocate(__len));
iterator __new_finish(__new_start);
! try {
__new_finish = uninitialized_copy(begin(), __position, __new_start);
__new_finish = uninitialized_fill_n(__new_finish, __n, __x);
__new_finish
= uninitialized_copy(__position, end(), __new_finish);
}
! catch(...)
! {
! _Destroy(__new_start,__new_finish);
! _M_deallocate(__new_start.base(),__len);
! __throw_exception_again;
! }
_Destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start.base();
*************** vector<_Tp, _Alloc>::_M_range_insert(ite
*** 761,775 ****
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start(_M_allocate(__len));
iterator __new_finish(__new_start);
! __STL_TRY {
__new_finish = uninitialized_copy(iterator(_M_start),
__position, __new_start);
__new_finish = uninitialized_copy(__first, __last, __new_finish);
__new_finish
= uninitialized_copy(__position, iterator(_M_finish), __new_finish);
}
! __STL_UNWIND((_Destroy(__new_start,__new_finish),
! _M_deallocate(__new_start.base(),__len)));
_Destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start.base();
--- 777,795 ----
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start(_M_allocate(__len));
iterator __new_finish(__new_start);
! try {
__new_finish = uninitialized_copy(iterator(_M_start),
__position, __new_start);
__new_finish = uninitialized_copy(__first, __last, __new_finish);
__new_finish
= uninitialized_copy(__position, iterator(_M_finish), __new_finish);
}
! catch(...)
! {
! _Destroy(__new_start,__new_finish);
! _M_deallocate(__new_start.base(), __len);
! __throw_exception_again;
! }
_Destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start.base();
Index: include/ext/ropeimpl.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/ropeimpl.h,v
retrieving revision 1.6
diff -c -p -r1.6 ropeimpl.h
*** ropeimpl.h 2001/07/04 18:12:08 1.6
--- ropeimpl.h 2001/10/24 01:38:58
***************
*** 46,56 ****
#include <bits/std_cstdio.h>
#include <bits/std_iostream.h>
- #ifdef __STL_USE_EXCEPTIONS
- # include <bits/std_stdexcept.h>
- #endif
-
namespace std
{
--- 46,53 ----
#include <bits/std_cstdio.h>
#include <bits/std_iostream.h>
+ # include <bits/functexcept.h>
namespace std
{
*************** void _Rope_iterator_base<_CharT,_Alloc>:
*** 98,104 ****
}
break;
default:
! __stl_assert(0);
}
}
--- 95,101 ----
}
break;
default:
! break;
}
}
*************** void _Rope_iterator_base<_CharT,_Alloc>:
*** 115,121 ****
size_t __pos = __x._M_current_pos;
unsigned char __dirns = 0; // Bit vector marking right turns in the path
- __stl_assert(__pos <= __x._M_root->_M_size);
if (__pos >= __x._M_root->_M_size) {
__x._M_buf_ptr = 0;
return;
--- 112,117 ----
*************** void _Rope_iterator_base<_CharT,_Alloc>:
*** 133,139 ****
}
for(;;) {
++__curr_depth;
- __stl_assert(__curr_depth <= _RopeRep::_S_max_rope_depth);
__path[__curr_depth] = __curr_rope;
switch(__curr_rope->_M_tag) {
case _RopeRep::_S_leaf:
--- 129,134 ----
*************** void _Rope_iterator_base<_CharT,_Alloc>:
*** 189,201 ****
unsigned char __dirns = __x._M_path_directions;
_Rope_RopeConcatenation<_CharT,_Alloc>* __c;
- __stl_assert(__x._M_current_pos <= __x._M_root->_M_size);
if (__x._M_current_pos - __node_start_pos < __len) {
/* More stuff in this leaf, we just didn't cache it. */
_S_setbuf(__x);
return;
}
- __stl_assert(__node_start_pos + __len == __x._M_current_pos);
// node_start_pos is starting position of last_node.
while (--__current_index >= 0) {
if (!(__dirns & 1) /* Path turned left */)
--- 184,194 ----
*************** rope<_CharT,_Alloc>::_S_leaf_concat_char
*** 408,419 ****
uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
uninitialized_copy_n(__iter, __len, __new_data + __old_len);
_S_cond_store_eos(__new_data[__old_len + __len]);
! __STL_TRY {
__result = _S_new_RopeLeaf(__new_data, __old_len + __len,
__r->get_allocator());
}
! __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
! __r->get_allocator()));
return __result;
}
--- 401,416 ----
uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
uninitialized_copy_n(__iter, __len, __new_data + __old_len);
_S_cond_store_eos(__new_data[__old_len + __len]);
! try {
__result = _S_new_RopeLeaf(__new_data, __old_len + __len,
__r->get_allocator());
}
! catch(...)
! {
! _RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
! __r->get_allocator());
! __throw_exception_again;
! }
return __result;
}
*************** rope<_CharT,_Alloc>::_RopeLeaf*
*** 424,430 ****
rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter
(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
{
- __stl_assert(__r->_M_ref_count >= 1);
if (__r->_M_ref_count > 1)
return _S_leaf_concat_char_iter(__r, __iter, __len);
size_t __old_len = __r->_M_size;
--- 421,426 ----
*************** rope<_CharT,_Alloc>::_S_destr_leaf_conca
*** 434,451 ****
uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len);
if (_S_is_basic_char_type((_CharT*)0)) {
_S_cond_store_eos(__r->_M_data[__old_len + __len]);
- __stl_assert(__r->_M_c_string == __r->_M_data);
} else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
__r->_M_free_c_string();
__r->_M_c_string = 0;
}
__r->_M_size = __old_len + __len;
- __stl_assert(__r->_M_ref_count == 1);
__r->_M_ref_count = 2;
return __r;
} else {
_RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
- __stl_assert(__result->_M_ref_count == 1);
return __result;
}
}
--- 430,444 ----
*************** template <class _CharT, class _Alloc>
*** 458,491 ****
rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right)
{
! _RopeConcatenation* __result =
! _S_new_RopeConcatenation(__left, __right, __left->get_allocator());
! size_t __depth = __result->_M_depth;
! __stl_assert(__left->get_allocator() == __right->get_allocator());
! if (__depth > 20 && (__result->_M_size < 1000 ||
! __depth > _RopeRep::_S_max_rope_depth)) {
! _RopeRep* __balanced;
! __STL_TRY {
! __balanced = _S_balance(__result);
! # ifndef __GC
! if (__result != __balanced) {
! __stl_assert(1 == __result->_M_ref_count
! && 1 == __balanced->_M_ref_count);
! }
! # endif
! __result->_M_unref_nonnil();
}
! __STL_UNWIND((_C_deallocate(__result,1)));
! // In case of exception, we need to deallocate
! // otherwise dangling result node. But caller
! // still owns its children. Thus unref is
! // inappropriate.
! return __balanced;
! } else {
! return __result;
! }
}
template <class _CharT, class _Alloc>
--- 451,483 ----
rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right)
{
! _RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
! __left->get_allocator());
! size_t __depth = __result->_M_depth;
! if (__depth > 20 && (__result->_M_size < 1000 ||
! __depth > _RopeRep::_S_max_rope_depth))
! {
! _RopeRep* __balanced;
! try
! {
! __balanced = _S_balance(__result);
! __result->_M_unref_nonnil();
}
! catch(...)
! {
! _C_deallocate(__result,1);
! __throw_exception_again;
! }
! // In case of exception, we need to deallocate
! // otherwise dangling result node. But caller
! // still owns its children. Thus unref is
! // inappropriate.
! return __balanced;
! }
! else
! return __result;
}
template <class _CharT, class _Alloc>
*************** rope<_CharT,_Alloc>::_RopeRep* rope<_Cha
*** 503,511 ****
if (_RopeRep::_S_leaf == __r->_M_tag &&
__r->_M_size + __slen <= _S_copy_max) {
__result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
- # ifndef __GC
- __stl_assert(1 == __result->_M_ref_count);
- # endif
return __result;
}
if (_RopeRep::_S_concat == __r->_M_tag
--- 495,500 ----
*************** rope<_CharT,_Alloc>::_RopeRep* rope<_Cha
*** 517,542 ****
_RopeRep* __nright =
_S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
__left->_M_ref_nonnil();
! __STL_TRY {
__result = _S_tree_concat(__left, __nright);
}
! __STL_UNWIND(_S_unref(__left); _S_unref(__nright));
! # ifndef __GC
! __stl_assert(1 == __result->_M_ref_count);
! # endif
return __result;
}
}
_RopeRep* __nright =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
! __STL_TRY {
__r->_M_ref_nonnil();
__result = _S_tree_concat(__r, __nright);
}
! __STL_UNWIND(_S_unref(__r); _S_unref(__nright));
! # ifndef __GC
! __stl_assert(1 == __result->_M_ref_count);
! # endif
return __result;
}
--- 506,535 ----
_RopeRep* __nright =
_S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
__left->_M_ref_nonnil();
! try {
__result = _S_tree_concat(__left, __nright);
}
! catch(...)
! {
! _S_unref(__left);
! _S_unref(__nright);
! __throw_exception_again;
! }
return __result;
}
}
_RopeRep* __nright =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
! try {
__r->_M_ref_nonnil();
__result = _S_tree_concat(__r, __nright);
}
! catch(...)
! {
! _S_unref(__r);
! _S_unref(__nright);
! __throw_exception_again;
! }
return __result;
}
*************** rope<_CharT,_Alloc>::_S_destr_concat_cha
*** 552,558 ****
__r->get_allocator());
size_t __count = __r->_M_ref_count;
size_t __orig_size = __r->_M_size;
- __stl_assert(__count >= 1);
if (__count > 1) return _S_concat_char_iter(__r, __s, __slen);
if (0 == __slen) {
__r->_M_ref_count = 2; // One more than before
--- 545,550 ----
*************** rope<_CharT,_Alloc>::_S_destr_concat_cha
*** 569,582 ****
&& __right->_M_size + __slen <= _S_copy_max) {
_RopeRep* __new_right =
_S_destr_leaf_concat_char_iter(__right, __s, __slen);
! if (__right == __new_right) {
! __stl_assert(__new_right->_M_ref_count == 2);
! __new_right->_M_ref_count = 1;
! } else {
! __stl_assert(__new_right->_M_ref_count >= 1);
! __right->_M_unref_nonnil();
! }
! __stl_assert(__r->_M_ref_count == 1);
__r->_M_ref_count = 2; // One more than before.
((_RopeConcatenation*)__r)->_M_right = __new_right;
__r->_M_size = __orig_size + __slen;
--- 561,570 ----
&& __right->_M_size + __slen <= _S_copy_max) {
_RopeRep* __new_right =
_S_destr_leaf_concat_char_iter(__right, __s, __slen);
! if (__right == __new_right)
! __new_right->_M_ref_count = 1;
! else
! __right->_M_unref_nonnil();
__r->_M_ref_count = 2; // One more than before.
((_RopeConcatenation*)__r)->_M_right = __new_right;
__r->_M_size = __orig_size + __slen;
*************** rope<_CharT,_Alloc>::_S_destr_concat_cha
*** 590,600 ****
_RopeRep* __right =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
__r->_M_ref_nonnil();
! __STL_TRY {
__result = _S_tree_concat(__r, __right);
}
! __STL_UNWIND(_S_unref(__r); _S_unref(__right))
! __stl_assert(1 == __result->_M_ref_count);
return __result;
}
#endif /* !__GC */
--- 578,592 ----
_RopeRep* __right =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
__r->_M_ref_nonnil();
! try {
__result = _S_tree_concat(__r, __right);
}
! catch(...)
! {
! _S_unref(__r);
! _S_unref(__right);
! __throw_exception_again;
! }
return __result;
}
#endif /* !__GC */
*************** rope<_CharT,_Alloc>::_S_concat(_RopeRep*
*** 629,647 ****
((_RopeLeaf*)__right)->_M_data,
__right->_M_size);
__leftleft->_M_ref_nonnil();
! __STL_TRY {
return(_S_tree_concat(__leftleft, __rest));
}
! __STL_UNWIND(_S_unref(__leftleft); _S_unref(__rest))
}
}
}
__left->_M_ref_nonnil();
__right->_M_ref_nonnil();
! __STL_TRY {
return(_S_tree_concat(__left, __right));
}
! __STL_UNWIND(_S_unref(__left); _S_unref(__right));
}
template <class _CharT, class _Alloc>
--- 621,649 ----
((_RopeLeaf*)__right)->_M_data,
__right->_M_size);
__leftleft->_M_ref_nonnil();
! try {
return(_S_tree_concat(__leftleft, __rest));
}
! catch(...)
! {
! _S_unref(__leftleft);
! _S_unref(__rest);
! __throw_exception_again;
! }
}
}
}
__left->_M_ref_nonnil();
__right->_M_ref_nonnil();
! try {
return(_S_tree_concat(__left, __right));
}
! catch(...)
! {
! _S_unref(__left);
! _S_unref(__right);
! __throw_exception_again;
! }
}
template <class _CharT, class _Alloc>
*************** rope<_CharT,_Alloc>::_S_substring(_RopeR
*** 684,692 ****
_Self_destruct_ptr __right_result(
_S_substring(__right, 0, __endp1 - __left_len));
__result = _S_concat(__left_result, __right_result);
- # ifndef __GC
- __stl_assert(1 == __result->_M_ref_count);
- # endif
return __result;
}
case _RopeRep::_S_leaf:
--- 686,691 ----
*************** rope<_CharT,_Alloc>::_S_substring(_RopeR
*** 738,755 ****
if (__result_len > __lazy_threshold) goto lazy;
__section = (_CharT*)
_Data_allocate(_S_rounded_up_size(__result_len));
! __STL_TRY {
(*(__f->_M_fn))(__start, __result_len, __section);
}
! __STL_UNWIND(_RopeRep::__STL_FREE_STRING(
! __section, __result_len, __base->get_allocator()));
_S_cond_store_eos(__section[__result_len]);
return _S_new_RopeLeaf(__section, __result_len,
__base->get_allocator());
}
}
- /*NOTREACHED*/
- __stl_assert(false);
lazy:
{
// Create substring node.
--- 737,756 ----
if (__result_len > __lazy_threshold) goto lazy;
__section = (_CharT*)
_Data_allocate(_S_rounded_up_size(__result_len));
! try {
(*(__f->_M_fn))(__start, __result_len, __section);
}
! catch(...)
! {
! _RopeRep::__STL_FREE_STRING(
! __section, __result_len, __base->get_allocator());
! __throw_exception_again;
! }
_S_cond_store_eos(__section[__result_len]);
return _S_new_RopeLeaf(__section, __result_len,
__base->get_allocator());
}
}
lazy:
{
// Create substring node.
*************** bool rope<_CharT, _Alloc>::_S_apply_to_p
*** 862,880 ****
bool __result;
_CharT* __buffer =
(_CharT*)alloc::allocate(__len * sizeof(_CharT));
! __STL_TRY {
(*(__f->_M_fn))(__begin, __len, __buffer);
__result = __c(__buffer, __len);
alloc::deallocate(__buffer, __len * sizeof(_CharT));
}
! __STL_UNWIND((alloc::deallocate(__buffer,
! __len * sizeof(_CharT))))
return __result;
}
default:
! __stl_assert(false);
! /*NOTREACHED*/
! return false;
}
}
--- 863,882 ----
bool __result;
_CharT* __buffer =
(_CharT*)alloc::allocate(__len * sizeof(_CharT));
! try {
(*(__f->_M_fn))(__begin, __len, __buffer);
__result = __c(__buffer, __len);
alloc::deallocate(__buffer, __len * sizeof(_CharT));
}
! catch(...)
! {
! alloc::deallocate(__buffer, __len * sizeof(_CharT));
! __throw_exception_again;
! }
return __result;
}
default:
! return false;
}
}
*************** basic_ostream<_CharT, _Traits>& operator
*** 909,915 ****
__pad_len = 0;
}
if (!__is_simple) __o.width(__w/__rope_len);
! __STL_TRY {
if (__is_simple && !__left && __pad_len > 0) {
_Rope_fill(__o, __pad_len);
}
--- 911,917 ----
__pad_len = 0;
}
if (!__is_simple) __o.width(__w/__rope_len);
! try {
if (__is_simple && !__left && __pad_len > 0) {
_Rope_fill(__o, __pad_len);
}
*************** basic_ostream<_CharT, _Traits>& operator
*** 920,926 ****
if (!__is_simple)
__o.width(__w);
}
! __STL_UNWIND(if (!__is_simple) __o.width(__w))
return __o;
}
--- 922,933 ----
if (!__is_simple)
__o.width(__w);
}
! catch(...)
! {
! if (!__is_simple)
! __o.width(__w);
! __throw_exception_again;
! }
return __o;
}
*************** rope<_CharT,_Alloc>::_S_flatten(_RopeRep
*** 977,984 ****
return __buffer + __f->_M_size;
}
default:
- __stl_assert(false);
- /*NOTREACHED*/
return 0;
}
}
--- 984,989 ----
*************** rope<_CharT,_Alloc>::_S_balance(_RopeRep
*** 1081,1087 ****
for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
__forest[__i] = 0;
! __STL_TRY {
_S_add_to_forest(__r, __forest);
for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
if (0 != __forest[__i]) {
--- 1086,1092 ----
for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
__forest[__i] = 0;
! try {
_S_add_to_forest(__r, __forest);
for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
if (0 != __forest[__i]) {
*************** rope<_CharT,_Alloc>::_S_balance(_RopeRep
*** 1090,1109 ****
# endif
__result = _S_concat(__forest[__i], __result);
__forest[__i]->_M_unref_nonnil();
! # if !defined(__GC) && defined(__STL_USE_EXCEPTIONS)
__forest[__i] = 0;
# endif
}
- }
- __STL_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; __i++)
- _S_unref(__forest[__i]))
- if (__result->_M_depth > _RopeRep::_S_max_rope_depth) {
- # ifdef __STL_USE_EXCEPTIONS
- __STL_THROW(length_error("rope too long"));
- # else
- abort();
- # endif
}
return(__result);
}
--- 1095,1114 ----
# endif
__result = _S_concat(__forest[__i], __result);
__forest[__i]->_M_unref_nonnil();
! # if !defined(__GC) && defined(__EXCEPTIONS)
__forest[__i] = 0;
# endif
}
}
+ catch(...)
+ {
+ for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; __i++)
+ _S_unref(__forest[__i]);
+ __throw_exception_again;
+ }
+
+ if (__result->_M_depth > _RopeRep::_S_max_rope_depth)
+ __throw_length_error("rope too long");
return(__result);
}
*************** rope<_CharT,_Alloc>::_S_add_to_forest(_R
*** 1116,1122 ****
_S_add_leaf_to_forest(__r, __forest);
return;
}
! __stl_assert(__r->_M_tag == _RopeRep::_S_concat);
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
--- 1121,1127 ----
_S_add_leaf_to_forest(__r, __forest);
return;
}
!
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
*************** rope<_CharT,_Alloc>::_S_add_leaf_to_fore
*** 1153,1160 ****
}
// Too_tiny dead, and no longer included in refcount.
// Insertee is live and included.
- __stl_assert(_S_is_almost_balanced(__insertee));
- __stl_assert(__insertee->_M_depth <= __r->_M_depth + 1);
for (;; ++__i) {
if (0 != __forest[__i]) {
# ifndef __GC
--- 1158,1163 ----
*************** rope<_CharT,_Alloc>::_S_add_leaf_to_fore
*** 1163,1172 ****
__insertee = _S_concat_and_set_balanced(__forest[__i], __insertee);
__forest[__i]->_M_unref_nonnil();
__forest[__i] = 0;
- __stl_assert(_S_is_almost_balanced(__insertee));
}
- __stl_assert(_S_min_len[__i] <= __insertee->_M_size);
- __stl_assert(__forest[__i] == 0);
if (__i == _RopeRep::_S_max_rope_depth ||
__insertee->_M_size < _S_min_len[__i+1]) {
__forest[__i] = __insertee;
--- 1166,1172 ----
*************** rope<_CharT,_Alloc>::_S_fetch(_RopeRep*
*** 1182,1188 ****
{
__GC_CONST _CharT* __cstr = __r->_M_c_string;
- __stl_assert(__i < __r->_M_size);
if (0 != __cstr) return __cstr[__i];
for(;;) {
switch(__r->_M_tag) {
--- 1182,1187 ----
*************** _Rope_char_ref_proxy<_CharT, _Alloc>::op
*** 1336,1348 ****
_Self_destruct_ptr __result_left(
_My_rope::_S_destr_concat_char_iter(__left, &__c, 1));
- # ifndef __GC
- __stl_assert(__left == __result_left || 1 == __result_left->_M_ref_count);
- # endif
_RopeRep* __result =
_My_rope::_S_concat(__result_left, __right);
# ifndef __GC
- __stl_assert(1 <= __result->_M_ref_count);
_RopeRep::_S_unref(__old);
# endif
_M_root->_M_tree_ptr = __result;
--- 1335,1343 ----
*************** rope<_CharT, _Alloc>::rope(size_t __n, _
*** 1388,1397 ****
__rest_buffer = _Data_allocate(_S_rounded_up_size(__rest));
uninitialized_fill_n(__rest_buffer, __rest, __c);
_S_cond_store_eos(__rest_buffer[__rest]);
! __STL_TRY {
__remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
}
! __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a))
}
__remainder_rope._M_tree_ptr = __remainder;
if (__exponent != 0) {
--- 1383,1396 ----
__rest_buffer = _Data_allocate(_S_rounded_up_size(__rest));
uninitialized_fill_n(__rest_buffer, __rest, __c);
_S_cond_store_eos(__rest_buffer[__rest]);
! try {
__remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
}
! catch(...)
! {
! _RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a);
! __throw_exception_again;
! }
}
__remainder_rope._M_tree_ptr = __remainder;
if (__exponent != 0) {
*************** rope<_CharT, _Alloc>::rope(size_t __n, _
*** 1401,1419 ****
rope __base_rope;
uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
_S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
! __STL_TRY {
__base_leaf = _S_new_RopeLeaf(__base_buffer,
__exponentiate_threshold, __a);
}
! __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__base_buffer,
! __exponentiate_threshold, __a))
__base_rope._M_tree_ptr = __base_leaf;
if (1 == __exponent) {
__result = __base_rope;
- # ifndef __GC
- __stl_assert(2 == __result._M_tree_ptr->_M_ref_count);
- // One each for base_rope and __result
- # endif
} else {
__result = power(__base_rope, __exponent,
_Rope_Concat_fn<_CharT,_Alloc>());
--- 1400,1418 ----
rope __base_rope;
uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
_S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
! try {
__base_leaf = _S_new_RopeLeaf(__base_buffer,
__exponentiate_threshold, __a);
}
! catch(...)
! {
! _RopeRep::__STL_FREE_STRING(__base_buffer,
! __exponentiate_threshold, __a);
! __throw_exception_again;
! }
__base_rope._M_tree_ptr = __base_leaf;
if (1 == __exponent) {
__result = __base_rope;
} else {
__result = power(__base_rope, __exponent,
_Rope_Concat_fn<_CharT,_Alloc>());
*************** _Rope_rotate(_Rope_iterator __first,
*** 1490,1497 ****
typedef typename _Rope_iterator::value_type _CharT;
typedef typename _Rope_iterator::_allocator_type _Alloc;
- __stl_assert(__first.container() == __middle.container()
- && __middle.container() == __last.container());
rope<_CharT,_Alloc>& __r(__first.container());
rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
rope<_CharT,_Alloc> __suffix =
--- 1489,1494 ----
Index: include/ext/slist
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/slist,v
retrieving revision 1.9
diff -c -p -r1.9 slist
*** slist 2001/07/04 18:12:08 1.9
--- slist 2001/10/24 01:39:00
*************** private:
*** 317,337 ****
_Node* _M_create_node(const value_type& __x) {
_Node* __node = this->_M_get_node();
! __STL_TRY {
_Construct(&__node->_M_data, __x);
__node->_M_next = 0;
}
! __STL_UNWIND(this->_M_put_node(__node));
return __node;
}
_Node* _M_create_node() {
_Node* __node = this->_M_get_node();
! __STL_TRY {
_Construct(&__node->_M_data);
__node->_M_next = 0;
}
! __STL_UNWIND(this->_M_put_node(__node));
return __node;
}
--- 317,345 ----
_Node* _M_create_node(const value_type& __x) {
_Node* __node = this->_M_get_node();
! try {
_Construct(&__node->_M_data, __x);
__node->_M_next = 0;
}
! catch(...)
! {
! this->_M_put_node(__node);
! __throw_exception_again;
! }
return __node;
}
_Node* _M_create_node() {
_Node* __node = this->_M_get_node();
! try {
_Construct(&__node->_M_data);
__node->_M_next = 0;
}
! catch(...)
! {
! this->_M_put_node(__node);
! __throw_exception_again;
! }
return __node;
}
Index: include/ext/stl_hashtable.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stl_hashtable.h,v
retrieving revision 1.8
diff -c -p -r1.8 stl_hashtable.h
*** stl_hashtable.h 2001/07/04 18:12:08 1.8
--- stl_hashtable.h 2001/10/24 01:39:03
*************** private:
*** 516,526 ****
{
_Node* __n = _M_get_node();
__n->_M_next = 0;
! __STL_TRY {
_Construct(&__n->_M_val, __obj);
return __n;
}
! __STL_UNWIND(_M_put_node(__n));
}
void _M_delete_node(_Node* __n)
--- 516,530 ----
{
_Node* __n = _M_get_node();
__n->_M_next = 0;
! try {
_Construct(&__n->_M_val, __obj);
return __n;
}
! catch(...)
! {
! _M_put_node(__n);
! __throw_exception_again;
! }
}
void _M_delete_node(_Node* __n)
*************** void hashtable<_Val,_Key,_HF,_Ex,_Eq,_Al
*** 849,855 ****
if (__n > __old_n) {
vector<_Node*, _All> __tmp(__n, (_Node*)(0),
_M_buckets.get_allocator());
! __STL_TRY {
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
_Node* __first = _M_buckets[__bucket];
while (__first) {
--- 853,859 ----
if (__n > __old_n) {
vector<_Node*, _All> __tmp(__n, (_Node*)(0),
_M_buckets.get_allocator());
! try {
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
_Node* __first = _M_buckets[__bucket];
while (__first) {
*************** void hashtable<_Val,_Key,_HF,_Ex,_Eq,_Al
*** 862,868 ****
}
_M_buckets.swap(__tmp);
}
- # ifdef __STL_USE_EXCEPTIONS
catch(...) {
for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) {
while (__tmp[__bucket]) {
--- 866,871 ----
*************** void hashtable<_Val,_Key,_HF,_Ex,_Eq,_Al
*** 871,879 ****
__tmp[__bucket] = __next;
}
}
! throw;
}
- # endif /* __STL_USE_EXCEPTIONS */
}
}
}
--- 874,881 ----
__tmp[__bucket] = __next;
}
}
! __throw_exception_again;
}
}
}
}
*************** void hashtable<_Val,_Key,_HF,_Ex,_Eq,_Al
*** 937,943 ****
_M_buckets.clear();
_M_buckets.reserve(__ht._M_buckets.size());
_M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
! __STL_TRY {
for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
const _Node* __cur = __ht._M_buckets[__i];
if (__cur) {
--- 939,945 ----
_M_buckets.clear();
_M_buckets.reserve(__ht._M_buckets.size());
_M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
! try {
for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
const _Node* __cur = __ht._M_buckets[__i];
if (__cur) {
*************** void hashtable<_Val,_Key,_HF,_Ex,_Eq,_Al
*** 954,960 ****
}
_M_num_elements = __ht._M_num_elements;
}
! __STL_UNWIND(clear());
}
} // namespace std
--- 956,966 ----
}
_M_num_elements = __ht._M_num_elements;
}
! catch(...)
! {
! clear();
! __throw_exception_again;
! }
}
} // namespace std
Index: include/ext/stl_rope.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stl_rope.h,v
retrieving revision 1.6
diff -c -p -r1.6 stl_rope.h
*** stl_rope.h 2001/07/04 18:12:08 1.6
--- stl_rope.h 2001/10/24 01:39:10
*************** struct _Rope_RopeLeaf : public _Rope_Rop
*** 572,578 ****
: _Rope_RopeRep<_CharT,_Alloc>(_S_leaf, 0, true, __size, __a),
_M_data(__d)
{
- __stl_assert(__size > 0);
if (_S_is_basic_char_type((_CharT *)0)) {
// already eos terminated.
_M_c_string = __d;
--- 572,577 ----
*************** struct _Rope_RopeFunction : public _Rope
*** 646,652 ****
, _M_delete_when_done(__d)
# endif
{
- __stl_assert(__size > 0);
# ifdef __GC
if (__d) {
GC_REGISTER_FINALIZER(
--- 645,650 ----
*************** struct _Rope_RopeSubstring : public _Rop
*** 685,692 ****
{
char_producer<_CharT>* __fn =
((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
- __stl_assert(__start_pos + __req_len <= _M_size);
- __stl_assert(_M_start + _M_size <= _M_base->_M_size);
(*__fn)(__start_pos + _M_start, __req_len, __buffer);
}
break;
--- 683,688 ----
*************** struct _Rope_RopeSubstring : public _Rop
*** 699,705 ****
}
break;
default:
! __stl_assert(false);
}
}
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
--- 695,701 ----
}
break;
default:
! break;
}
}
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
*************** struct _Rope_RopeSubstring : public _Rop
*** 711,718 ****
_M_base(__b),
_M_start(__s)
{
- __stl_assert(__l > 0);
- __stl_assert(__s + __l <= __b->_M_size);
# ifndef __GC
_M_base->_M_ref_nonnil();
# endif
--- 707,712 ----
*************** struct _Rope_RopeSubstring : public _Rop
*** 743,753 ****
_Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
~_Rope_self_destruct_ptr()
{ _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
! # ifdef __STL_USE_EXCEPTIONS
_Rope_self_destruct_ptr() : _M_ptr(0) {};
! # else
_Rope_self_destruct_ptr() {};
! # endif
_Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
_Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
_Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
--- 737,747 ----
_Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
~_Rope_self_destruct_ptr()
{ _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
! #ifdef __EXCEPTIONS
_Rope_self_destruct_ptr() : _M_ptr(0) {};
! #else
_Rope_self_destruct_ptr() {};
! #endif
_Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
_Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
_Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
*************** class _Rope_char_ptr_proxy {
*** 818,824 ****
: _M_pos(__x._M_pos), _M_root(__x._M_root) {}
_Rope_char_ptr_proxy() {}
_Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) {
- __stl_assert(0 == __x);
}
_Rope_char_ptr_proxy&
operator= (const _Rope_char_ptr_proxy& __x) {
--- 812,817 ----
*************** class rope : public _Rope_base<_CharT,_A
*** 1403,1412 ****
uninitialized_copy_n(__s, __size, __buf);
_S_cond_store_eos(__buf[__size]);
! __STL_TRY {
return _S_new_RopeLeaf(__buf, __size, __a);
}
! __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, __size, __a))
}
--- 1396,1409 ----
uninitialized_copy_n(__s, __size, __buf);
_S_cond_store_eos(__buf[__size]);
! try {
return _S_new_RopeLeaf(__buf, __size, __a);
}
! catch(...)
! {
! _RopeRep::__STL_FREE_STRING(__buf, __size, __a);
! __throw_exception_again;
! }
}
*************** class rope : public _Rope_base<_CharT,_A
*** 1541,1550 ****
_CharT* __buf = _Data_allocate(_S_rounded_up_size(1));
_Construct(__buf, __c);
! __STL_TRY {
_M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a);
}
! __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, 1, __a))
}
rope(size_t __n, _CharT __c,
--- 1538,1551 ----
_CharT* __buf = _Data_allocate(_S_rounded_up_size(1));
_Construct(__buf, __c);
! try {
_M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a);
}
! catch(...)
! {
! _RopeRep::__STL_FREE_STRING(__buf, 1, __a);
! __throw_exception_again;
! }
}
rope(size_t __n, _CharT __c,
*************** class rope : public _Rope_base<_CharT,_A
*** 1576,1582 ****
rope& operator=(const rope& __x)
{
_RopeRep* __old = _M_tree_ptr;
- __stl_assert(get_allocator() == __x.get_allocator());
_M_tree_ptr = __x._M_tree_ptr;
_S_ref(_M_tree_ptr);
_S_unref(__old);
--- 1577,1582 ----
*************** class rope : public _Rope_base<_CharT,_A
*** 1614,1625 ****
_RopeRep* __old = _M_tree_ptr;
_RopeRep* __left =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator());
! __STL_TRY {
_M_tree_ptr = _S_concat(__left, _M_tree_ptr);
_S_unref(__old);
_S_unref(__left);
}
! __STL_UNWIND(_S_unref(__left))
}
void pop_front()
--- 1614,1629 ----
_RopeRep* __old = _M_tree_ptr;
_RopeRep* __left =
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator());
! try {
_M_tree_ptr = _S_concat(__left, _M_tree_ptr);
_S_unref(__old);
_S_unref(__left);
}
! catch(...)
! {
! _S_unref(__left);
! __throw_exception_again;
! }
}
void pop_front()
*************** class rope : public _Rope_base<_CharT,_A
*** 1793,1800 ****
}
rope& append(const_iterator __s, const_iterator __e) {
- __stl_assert(__s._M_root == __e._M_root);
- __stl_assert(get_allocator() == __s._M_root->get_allocator());
_Self_destruct_ptr __appendee(_S_substring(
__s._M_root, __s._M_current_pos, __e._M_current_pos));
_RopeRep* __result =
--- 1797,1802 ----
*************** class rope : public _Rope_base<_CharT,_A
*** 1815,1821 ****
rope& append() { return append(_CharT()); } // XXX why?
rope& append(const rope& __y) {
- __stl_assert(__y.get_allocator() == get_allocator());
_RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr);
_S_unref(_M_tree_ptr);
_M_tree_ptr = __result;
--- 1817,1822 ----
*************** class rope : public _Rope_base<_CharT,_A
*** 1828,1834 ****
}
void swap(rope& __b) {
- __stl_assert(get_allocator() == __b.get_allocator());
_RopeRep* __tmp = _M_tree_ptr;
_M_tree_ptr = __b._M_tree_ptr;
__b._M_tree_ptr = __tmp;
--- 1829,1834 ----
*************** class rope : public _Rope_base<_CharT,_A
*** 1846,1852 ****
_S_substring(__old, __pos2, __old->_M_size));
_RopeRep* __result;
- __stl_assert(__old->get_allocator() == __r->get_allocator());
if (0 == __r) {
__result = _S_concat(__left, __right);
} else {
--- 1846,1851 ----
*************** class rope : public _Rope_base<_CharT,_A
*** 1860,1866 ****
void insert(size_t __p, const rope& __r) {
_RopeRep* __result =
replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr);
- __stl_assert(get_allocator() == __r.get_allocator());
_S_unref(_M_tree_ptr);
_M_tree_ptr = __result;
}
--- 1859,1864 ----
*************** rope<_CharT,_Alloc>
*** 2326,2332 ****
operator+ (const rope<_CharT,_Alloc>& __left,
const rope<_CharT,_Alloc>& __right)
{
- __stl_assert(__left.get_allocator() == __right.get_allocator());
return rope<_CharT,_Alloc>(
rope<_CharT,_Alloc>::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr));
// Inlining this should make it possible to keep __left and
--- 2324,2329 ----
Index: libsupc++/eh_aux_runtime.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/eh_aux_runtime.cc,v
retrieving revision 1.1
diff -c -p -r1.1 eh_aux_runtime.cc
*** eh_aux_runtime.cc 2001/03/28 11:04:50 1.1
--- eh_aux_runtime.cc 2001/10/24 01:39:10
***************
*** 30,36 ****
#include "typeinfo"
#include "exception"
! #include <cstddef>
#include "unwind-cxx.h"
#include "exception_defines.h"
--- 30,36 ----
#include "typeinfo"
#include "exception"
! #include <cstdlib>
#include "unwind-cxx.h"
#include "exception_defines.h"
*************** __cxa_bad_typeid ()
*** 54,56 ****
--- 54,57 ----
std::abort();
#endif
}
+
Index: libsupc++/eh_personality.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/eh_personality.cc,v
retrieving revision 1.5
diff -c -p -r1.5 eh_personality.cc
*** eh_personality.cc 2001/09/03 12:24:24 1.5
--- eh_personality.cc 2001/10/24 01:39:11
***************
*** 30,35 ****
--- 30,36 ----
#include <bits/c++config.h>
#include <cstdlib>
+ #include <exception_defines.h>
#include "unwind-cxx.h"
using namespace __cxxabiv1;
*************** __cxa_call_unexpected (_Unwind_Exception
*** 412,442 ****
__cxa_exception *xh = __get_exception_header_from_ue (exc_obj);
! try {
! __unexpected (xh->unexpectedHandler);
! } catch (...) {
! // Get the exception thrown from unexpected.
! // ??? Foreign exceptions can't be stacked this way.
!
! __cxa_eh_globals *globals = __cxa_get_globals_fast ();
! __cxa_exception *new_xh = globals->caughtExceptions;
!
! // We don't quite have enough stuff cached; re-parse the LSDA.
! lsda_header_info info;
! parse_lsda_header (0, xh->languageSpecificData, &info);
! info.ttype_base = (_Unwind_Ptr) xh->catchTemp;
!
! // If this new exception meets the exception spec, allow it.
! if (check_exception_spec (&info, new_xh->exceptionType,
! xh->handlerSwitchValue))
! throw;
!
! // If the exception spec allows std::bad_exception, throw that.
! const std::type_info &bad_exc = typeid (std::bad_exception);
! if (check_exception_spec (&info, &bad_exc, xh->handlerSwitchValue))
! throw std::bad_exception ();
!
! // Otherwise, die.
! __terminate(xh->terminateHandler);
! }
}
--- 413,445 ----
__cxa_exception *xh = __get_exception_header_from_ue (exc_obj);
! try
! { __unexpected (xh->unexpectedHandler); }
! catch(...)
! {
! // Get the exception thrown from unexpected.
! // ??? Foreign exceptions can't be stacked this way.
!
! __cxa_eh_globals *globals = __cxa_get_globals_fast ();
! __cxa_exception *new_xh = globals->caughtExceptions;
!
! // We don't quite have enough stuff cached; re-parse the LSDA.
! lsda_header_info info;
! parse_lsda_header (0, xh->languageSpecificData, &info);
! info.ttype_base = (_Unwind_Ptr) xh->catchTemp;
!
! // If this new exception meets the exception spec, allow it.
! if (check_exception_spec (&info, new_xh->exceptionType,
! xh->handlerSwitchValue))
! __throw_exception_again;
!
! // If the exception spec allows std::bad_exception, throw that.
! #ifdef __EXCEPTIONS
! const std::type_info &bad_exc = typeid (std::bad_exception);
! if (check_exception_spec (&info, &bad_exc, xh->handlerSwitchValue))
! throw std::bad_exception();
! #endif
! // Otherwise, die.
! __terminate(xh->terminateHandler);
! }
}
Index: libsupc++/new_op.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/new_op.cc,v
retrieving revision 1.3
diff -c -p -r1.3 new_op.cc
*** new_op.cc 2001/02/16 00:43:41 1.3
--- new_op.cc 2001/10/24 01:39:11
***************
*** 28,33 ****
--- 28,34 ----
// the GNU General Public License.
#include "new"
+ #include <cstdlib>
#include <exception_defines.h>
using std::new_handler;
Index: libsupc++/vec.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/vec.cc,v
retrieving revision 1.8
diff -c -p -r1.8 vec.cc
*** vec.cc 2001/03/28 11:04:50 1.8
--- vec.cc 2001/10/24 01:39:12
***************
*** 34,40 ****
#include <new>
#include <exception>
#include <exception_defines.h>
-
#include "unwind-cxx.h"
namespace __cxxabiv1
--- 34,39 ----
Index: src/functexcept.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/functexcept.cc,v
retrieving revision 1.1
diff -c -p -r1.1 functexcept.cc
*** functexcept.cc 2001/02/16 00:44:44 1.1
--- functexcept.cc 2001/10/24 01:39:12
*************** namespace std
*** 110,152 ****
{ abort(); }
void
! __throw_logic_error(const char* __s)
{ abort(); }
void
! __throw_domain_error(const char* __s)
{ abort(); }
void
! __throw_invalid_argument(const char* __s)
{ abort(); }
void
! __throw_length_error(const char* __s)
{ abort(); }
void
! __throw_out_of_range(const char* __s)
{ abort(); }
void
! __throw_runtime_error(const char* __s)
{ abort(); }
void
! __throw_range_error(const char* __s)
{ abort(); }
void
! __throw_overflow_error(const char* __s)
{ abort(); }
void
! __throw_underflow_error(const char* __s)
{ abort(); }
void
! __throw_ios_failure(const char* __s)
{ abort(); }
#endif //__EXCEPTIONS
}
--- 110,152 ----
{ abort(); }
void
! __throw_logic_error(const char*)
{ abort(); }
void
! __throw_domain_error(const char*)
{ abort(); }
void
! __throw_invalid_argument(const char*)
{ abort(); }
void
! __throw_length_error(const char*)
{ abort(); }
void
! __throw_out_of_range(const char*)
{ abort(); }
void
! __throw_runtime_error(const char*)
{ abort(); }
void
! __throw_range_error(const char*)
{ abort(); }
void
! __throw_overflow_error(const char*)
{ abort(); }
void
! __throw_underflow_error(const char*)
{ abort(); }
void
! __throw_ios_failure(const char*)
{ abort(); }
#endif //__EXCEPTIONS
}
Index: testsuite/23_containers/bitset_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/23_containers/bitset_members.cc,v
retrieving revision 1.2
diff -c -p -r1.2 bitset_members.cc
*** bitset_members.cc 2001/08/07 03:38:30 1.2
--- bitset_members.cc 2001/10/24 01:39:13
***************
*** 23,37 ****
#include <bitset>
#include <testsuite_hooks.h>
! bool test01(void)
{
bool test = true;
const size_t n1 = 5;
! // the other 22 member functions should be in here too...
!
!
! // test()
try {
std::bitset<n1> five_bits;
bool unused = five_bits.test(n1); // should throw
--- 23,35 ----
#include <bitset>
#include <testsuite_hooks.h>
! void
! test01(void)
{
bool test = true;
const size_t n1 = 5;
! // the other 22 member functions should be in here too...
try {
std::bitset<n1> five_bits;
bool unused = five_bits.test(n1); // should throw
*************** bool test01(void)
*** 43,54 ****
catch(...) {
VERIFY( false );
}
!
!
! #ifdef DEBUG_ASSERT
! assert(test);
! #endif
! return test;
}
int main()
--- 41,47 ----
catch(...) {
VERIFY( false );
}
! VERIFY( test );
}
int main()