diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c2b7b8fc5c8..cb801578272 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2001-02-07 Benjamin Kosnik + + Clean up stdexcept. + * include/bits/stringfwd.h: New file. + * include/bits/stl_string_fwd.h: Remove. + * include/bits/localefwd.h: Remove declaration for allocator. + * include/bits/std_iosfwd: Same. + * include/bits/std_string.h: Include it. + * include/bits/std_ios.h: Remove include. + * include/bits/basic_string.h: Tweak. + * libsupc++/new: Format. + * src/Makefile.am (base_headers): Add stringfwd.h, remove + stl_string_fwd.h + * src/Makefile.in: Regenerate. + * include/bits/std_stdexcept.h: Rewrite. + * src/stdexcept.cc: Same. + 2001-02-06 Benjamin Kosnik * acinclude.m4 (GLIBCPP_EXPORT_INSTALL_INFO): Deal with library diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 06b0820afbf..b678dd27fd3 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -1028,7 +1028,6 @@ namespace std { inline basic_istream<_CharT,_Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Alloc>& __str); - } // namespace std #endif /* _CPP_BITS_STRING_H */ diff --git a/libstdc++-v3/include/bits/localefwd.h b/libstdc++-v3/include/bits/localefwd.h index 73b987a9243..5e08c7ec8af 100644 --- a/libstdc++-v3/include/bits/localefwd.h +++ b/libstdc++-v3/include/bits/localefwd.h @@ -79,8 +79,8 @@ namespace std }; // 22.1.1 Locale - template class allocator; - template class vector; + template + class vector; class locale; // 22.1.3 Convenience interfaces diff --git a/libstdc++-v3/include/bits/std_ios.h b/libstdc++-v3/include/bits/std_ios.h index 7fba3d75b2e..1471c1ca619 100644 --- a/libstdc++-v3/include/bits/std_ios.h +++ b/libstdc++-v3/include/bits/std_ios.h @@ -1,6 +1,6 @@ // Iostreams base classes -*- C++ -*- -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2001 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 @@ -37,7 +37,6 @@ #include #include // For ios_base::failure #include // For char_traits, streamoff, streamsize, fpos -#include // For string. #include // For SEEK_SET, SEEK_CUR, SEEK_END #include // For class locale #include // For ios_base declarations. diff --git a/libstdc++-v3/include/bits/std_iosfwd.h b/libstdc++-v3/include/bits/std_iosfwd.h index 8f198800a01..15631a29e2b 100644 --- a/libstdc++-v3/include/bits/std_iosfwd.h +++ b/libstdc++-v3/include/bits/std_iosfwd.h @@ -36,13 +36,10 @@ #include #include // For mbstate_t +#include // For string forward declarations. -namespace std { - - // Generic declarations. - template struct char_traits; - template class allocator; - +namespace std +{ // Forward declarations template<> class char_traits; #ifdef _GLIBCPP_USE_WCHAR_T @@ -50,53 +47,53 @@ namespace std { #endif template > - class basic_ios; + class basic_ios; template > - class basic_streambuf; + class basic_streambuf; template > - class basic_istream; + class basic_istream; template > - class basic_ostream; + class basic_ostream; template > - class basic_iostream; + class basic_iostream; template, typename _Alloc = allocator<_CharT> > - class basic_stringbuf; + class basic_stringbuf; template, typename _Alloc = allocator<_CharT> > - class basic_istringstream; + class basic_istringstream; template, typename _Alloc = allocator<_CharT> > - class basic_ostringstream; + class basic_ostringstream; template, typename _Alloc = allocator<_CharT> > - class basic_stringstream; + class basic_stringstream; template > - class basic_filebuf; + class basic_filebuf; template > - class basic_ifstream; + class basic_ifstream; template > - class basic_ofstream; + class basic_ofstream; template > - class basic_fstream; + class basic_fstream; template > - class istreambuf_iterator; + class istreambuf_iterator; template > - class ostreambuf_iterator; + class ostreambuf_iterator; #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS // Not included. @@ -144,14 +141,6 @@ namespace std { typedef basic_ofstream wofstream; typedef basic_fstream wfstream; #endif - } // namespace std #endif // _CPP_IOSFWD - - - - - - - diff --git a/libstdc++-v3/include/bits/std_stdexcept.h b/libstdc++-v3/include/bits/std_stdexcept.h index 05b351116cd..b9c5dccf74a 100644 --- a/libstdc++-v3/include/bits/std_stdexcept.h +++ b/libstdc++-v3/include/bits/std_stdexcept.h @@ -1,90 +1,115 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ +// Standard exception classes -*- C++ -*- + +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 19.1 Exception classes +// #ifndef _CPP_STDEXCEPT -#define _CPP_STDEXCEPT 1 +#define _CPP_STDEXCEPT 1 #include +#include -#if defined(__STL_USE_EXCEPTIONS) || \ - !(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32) +namespace std +{ + class logic_error : public exception + { + const string& _M_msg; -#include + public: + explicit + logic_error(const string& __arg); -__STL_BEGIN_NAMESPACE + virtual + ~logic_error() throw(); -class __Named_exception : public exception { -public: - __Named_exception(const string& __str); - virtual const char* what() const __STL_NOTHROW { return _M_name; } + virtual const char* + what() const throw(); + }; -private: - enum { _S_bufsize = 256 }; - char _M_name[_S_bufsize]; -}; + class domain_error : public logic_error + { + public: + explicit domain_error(const string& __arg); + }; -class logic_error : public __Named_exception { -public: - logic_error(const string& __s) : __Named_exception(__s) {} -}; + class invalid_argument : public logic_error + { + public: + explicit invalid_argument(const string& __arg); + }; -class runtime_error : public __Named_exception { -public: - runtime_error(const string& __s) : __Named_exception(__s) {} -}; + class length_error : public logic_error + { + public: + explicit length_error(const string& __arg); + }; -class domain_error : public logic_error { -public: - domain_error(const string& __arg) : logic_error(__arg) {} -}; + class out_of_range : public logic_error + { + public: + explicit out_of_range(const string& __arg); + }; -class invalid_argument : public logic_error { -public: - invalid_argument(const string& __arg) : logic_error(__arg) {} -}; + class runtime_error : public exception + { + const string& _M_msg; -class length_error : public logic_error { -public: - length_error(const string& __arg) : logic_error(__arg) {} -}; + public: + explicit + runtime_error(const string& __arg); -class out_of_range : public logic_error { -public: - out_of_range(const string& __arg) : logic_error(__arg) {} -}; + virtual + ~runtime_error() throw(); -class range_error : public runtime_error { -public: - range_error(const string& __arg) : runtime_error(__arg) {} -}; + virtual const char* + what() const throw(); + }; -class overflow_error : public runtime_error { -public: - overflow_error(const string& __arg) : runtime_error(__arg) {} -}; + class range_error : public runtime_error + { + public: + explicit range_error(const string& __arg); + }; -class underflow_error : public runtime_error { -public: - underflow_error(const string& __arg) : runtime_error(__arg) {} -}; + class overflow_error : public runtime_error + { + public: + explicit overflow_error(const string& __arg); + }; -__STL_END_NAMESPACE - -#endif /* Not o32, and no exceptions */ - -#endif /* _CPP_STDEXCEPT */ - -// Local Variables: -// mode:C++ -// End: + class underflow_error : public runtime_error + { + public: + explicit underflow_error(const string& __arg); + }; +} // namespace std +#endif // _CPP_STDEXCEPT diff --git a/libstdc++-v3/include/bits/std_string.h b/libstdc++-v3/include/bits/std_string.h index eb023df718e..0a2da3ae729 100644 --- a/libstdc++-v3/include/bits/std_string.h +++ b/libstdc++-v3/include/bits/std_string.h @@ -35,11 +35,12 @@ #define _CPP_STRING 1 #include -#include -#include +#include #include +#include +#include // For allocator. #include -#include // for operators >>, <<, and getline decls +#include // For operators >>, <<, and getline decls. #include #ifdef _GLIBCPP_NO_TEMPLATE_EXPORT diff --git a/libstdc++-v3/include/bits/stl_string_fwd.h b/libstdc++-v3/include/bits/stl_string_fwd.h deleted file mode 100644 index 46845b9870c..00000000000 --- a/libstdc++-v3/include/bits/stl_string_fwd.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __SGI_STL_STRING_FWD_H -#define __SGI_STL_STRING_FWD_H - -#include -#include -#include - -__STL_BEGIN_NAMESPACE - -template , - class _Alloc = allocator<_CharT> > -class basic_string; - -typedef basic_string string; -#ifdef _GLIBCPP_USE_WCHAR_T -typedef basic_string wstring; -#endif - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_STRING_FWD_H */ - -// Local Variables: -// mode:C++ -// End: - - - - - - - diff --git a/libstdc++-v3/include/bits/stringfwd.h b/libstdc++-v3/include/bits/stringfwd.h new file mode 100644 index 00000000000..020257437ff --- /dev/null +++ b/libstdc++-v3/include/bits/stringfwd.h @@ -0,0 +1,61 @@ +// String support -*- C++ -*- + +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _CPP_BITS_STRINGFWD_H +#define _CPP_BITS_STRINGFWD_H 1 + +#include + +namespace std +{ + template + struct char_traits; + + template + class allocator; + + template, + typename _Alloc = allocator<_CharT> > + class basic_string; + + typedef basic_string string; +#ifdef _GLIBCPP_USE_WCHAR_T + typedef basic_string wstring; +#endif +} // namespace std + +#endif // _CPP_BITS_STRINGFWD_H + +// Local Variables: +// mode:c++ +// End: diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index cb66dacc444..87c9d712f37 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -1,5 +1,6 @@ // The -*- C++ -*- dynamic memory management header. -// Copyright (C) 1994, 1996, 1997, 1998, 2000 Free Software Foundation + +// Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001 Free Software Foundation // This file is part of GNU CC. // @@ -36,31 +37,31 @@ extern "C++" { -namespace std { - - class bad_alloc : public exception { +namespace std +{ + class bad_alloc : public exception + { public: virtual const char* what() const throw() { return "bad_alloc"; } }; - struct nothrow_t {}; + struct nothrow_t { }; extern const nothrow_t nothrow; typedef void (*new_handler)(); - new_handler set_new_handler (new_handler); - + new_handler set_new_handler(new_handler); } // namespace std -// replaceable signatures -void *operator new (std::size_t) throw (std::bad_alloc); -void *operator new[] (std::size_t) throw (std::bad_alloc); -void operator delete (void *) throw(); -void operator delete[] (void *) throw(); -void *operator new (std::size_t, const std::nothrow_t&) throw(); -void *operator new[] (std::size_t, const std::nothrow_t&) throw(); -void operator delete (void *, const std::nothrow_t&) throw(); -void operator delete[] (void *, const std::nothrow_t&) throw(); +// Replaceable signatures. +void *operator new(std::size_t) throw (std::bad_alloc); +void *operator new[](std::size_t) throw (std::bad_alloc); +void operator delete(void *) throw(); +void operator delete[](void *) throw(); +void *operator new(std::size_t, const std::nothrow_t&) throw(); +void *operator new[](std::size_t, const std::nothrow_t&) throw(); +void operator delete(void *, const std::nothrow_t&) throw(); +void operator delete[](void *, const std::nothrow_t&) throw(); -// default placement versions of operator new +// Default placement versions of operator new. inline void *operator new(std::size_t, void *place) throw() { return place; } inline void *operator new[](std::size_t, void *place) throw() { return place; } } // extern "C++" diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index b74fc9d8b78..788f968fe4b 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -21,7 +21,7 @@ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## USA. -## $Id: Makefile.am,v 1.69 2001/02/06 06:36:18 mmitchel Exp $ +## $Id: Makefile.am,v 1.70 2001/02/07 01:54:21 bkoz Exp $ AUTOMAKE_OPTIONS = 1.3 gnits MAINT_CHARSET = latin1 @@ -66,7 +66,8 @@ INCLUDES = \ base_headers = \ bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h \ - bits/std_string.h bits/basic_string.h bits/basic_string.tcc \ + bits/stringfwd.h bits/std_string.h bits/basic_string.h \ + bits/basic_string.tcc \ bits/generic_shadow.h bits/std_utility.h \ bits/std_complex.h \ bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \ @@ -94,7 +95,7 @@ base_headers = \ bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \ bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \ bits/stl_relops.h bits/stl_set.h \ - bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \ + bits/stl_stack.h bits/stl_tempbuf.h \ bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \ bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \ bits/concept_checks.h bits/container_concepts.h \ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 5e1fc2b24c2..f197451be7f 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -144,7 +144,7 @@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ INCLUDES = -nostdinc++ -I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) $(TOPLEVEL_INCLUDES) -base_headers = bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h bits/std_string.h bits/basic_string.h bits/basic_string.tcc bits/generic_shadow.h bits/std_utility.h bits/std_complex.h bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h bits/gslice.h bits/gslice_array.h bits/indirect_array.h bits/exception_support.h bits/std_fstream.h bits/std_iomanip.h bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h bits/std_istream.h bits/istream.tcc bits/std_locale.h bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h bits/streambuf.tcc bits/basic_file.h bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h bits/stl_pthread_alloc.h bits/pthread_allocimpl.h bits/stl_threads.h bits/stl_iterator_base.h bits/std_bitset.h bits/std_deque.h bits/std_functional.h bits/std_iterator.h bits/std_list.h bits/std_map.h bits/std_memory.h bits/std_numeric.h bits/std_queue.h bits/std_set.h bits/std_stack.h bits/std_stdexcept.h bits/std_vector.h bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h bits/stl_deque.h bits/stl_function.h bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h bits/concept_checks.h bits/container_concepts.h bits/sequence_concepts.h bits/stl_config.h bits/stl_construct.h +base_headers = bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h bits/stringfwd.h bits/std_string.h bits/basic_string.h bits/basic_string.tcc bits/generic_shadow.h bits/std_utility.h bits/std_complex.h bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h bits/gslice.h bits/gslice_array.h bits/indirect_array.h bits/exception_support.h bits/std_fstream.h bits/std_iomanip.h bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h bits/std_istream.h bits/istream.tcc bits/std_locale.h bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h bits/streambuf.tcc bits/basic_file.h bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h bits/stl_pthread_alloc.h bits/pthread_allocimpl.h bits/stl_threads.h bits/stl_iterator_base.h bits/std_bitset.h bits/std_deque.h bits/std_functional.h bits/std_iterator.h bits/std_list.h bits/std_map.h bits/std_memory.h bits/std_numeric.h bits/std_queue.h bits/std_set.h bits/std_stack.h bits/std_stdexcept.h bits/std_vector.h bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h bits/stl_deque.h bits/stl_function.h bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h bits/stl_relops.h bits/stl_set.h bits/stl_stack.h bits/stl_tempbuf.h bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h bits/concept_checks.h bits/container_concepts.h bits/sequence_concepts.h bits/stl_config.h bits/stl_construct.h backward_headers = backward/complex.h backward/iomanip.h backward/istream.h backward/ostream.h backward/stream.h backward/streambuf.h backward/algo.h backward/algobase.h backward/alloc.h backward/bvector.h backward/defalloc.h backward/deque.h backward/function.h backward/hash_map.h backward/hash_set.h backward/hashtable.h backward/heap.h backward/iterator.h backward/list.h backward/map.h backward/multimap.h backward/new.h backward/multiset.h backward/pair.h backward/iostream.h backward/rope.h backward/set.h backward/slist.h backward/stack.h backward/tempbuf.h backward/tree.h backward/vector.h backward/fstream.h backward/strstream.h backward/strstream diff --git a/libstdc++-v3/src/stdexcept.cc b/libstdc++-v3/src/stdexcept.cc index 147ff11099d..af22c9e0fa8 100644 --- a/libstdc++-v3/src/stdexcept.cc +++ b/libstdc++-v3/src/stdexcept.cc @@ -1,6 +1,6 @@ // Methods for Exception Support for -*- C++ -*- -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997, 1999, 2001 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 @@ -27,28 +27,59 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -// Written by Mike Stump based upon the specification in the 20 September 1994 -// C++ working paper, ANSI document X3J16/94-0158. - // // ISO C++ 14882: 19.1 Exception classes // #include #include +#if 1 #include +#endif -// To break the circularity with the and header we -// define two functions which throw exceptions as a direct call would do. +namespace std +{ + logic_error::logic_error(const string& __arg) + : exception(), _M_msg(__arg) { } -namespace std { + logic_error::~logic_error() throw() { }; - __Named_exception::__Named_exception(const string& __str) - { - strncpy(_M_name, __str.c_str(), _S_bufsize); - _M_name[_S_bufsize - 1] = '\0'; - } + const char* + logic_error::what() const throw() + { return _M_msg.c_str(); } + domain_error::domain_error(const string& __arg) + : logic_error(__arg) { } + + invalid_argument::invalid_argument(const string& __arg) + : logic_error(__arg) { } + + length_error::length_error(const string& __arg) + : logic_error(__arg) { } + + out_of_range::out_of_range(const string& __arg) + : logic_error(__arg) { } + + runtime_error::runtime_error(const string& __arg) + : exception(), _M_msg(__arg) { } + + runtime_error::~runtime_error() throw() { }; + + const char* + runtime_error::what() const throw() + { return _M_msg.c_str(); } + + range_error::range_error(const string& __arg) + : runtime_error(__arg) { } + + overflow_error::overflow_error(const string& __arg) + : runtime_error(__arg) { } + + underflow_error::underflow_error(const string& __arg) + : runtime_error(__arg) { } + +#if 1 + // XXX need to deal with this. void __out_of_range(const char *str) { throw out_of_range(str); } @@ -66,8 +97,8 @@ namespace std { void __stl_throw_length_error(const char* __msg) { throw length_error(__msg); } - -} //namespace std +#endif +} // namespace std