diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-07 20:26:24 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-07 20:26:24 +0000 |
commit | 15f85ffa17be2c112702013e0d5eebc0b5a3abec (patch) | |
tree | 710c4b07600eecce610471e49a8073942cbf0a1d /libstdc++-v3/include/bits | |
parent | ea298e004c40ead8035640c50738bb597dbede96 (diff) | |
download | gcc-15f85ffa17be2c112702013e0d5eebc0b5a3abec.tar.gz |
2001-02-07 Benjamin Kosnik <bkoz@redhat.com>
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39526 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/localefwd.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/std_ios.h | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/std_iosfwd.h | 47 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/std_stdexcept.h | 197 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/std_string.h | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_string_fwd.h | 46 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stringfwd.h | 61 |
8 files changed, 197 insertions, 169 deletions
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<typename _Tp> class allocator; - template<typename _Tp, typename _Alloc> class vector; + template<typename _Tp, typename _Alloc> + 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 <bits/std_iosfwd.h> #include <exception> // For ios_base::failure #include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos -#include <bits/stl_string_fwd.h>// For string. #include <bits/std_cstdio.h> // For SEEK_SET, SEEK_CUR, SEEK_END #include <bits/localefwd.h> // For class locale #include <bits/ios_base.h> // 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 <bits/c++config.h> #include <bits/std_cwchar.h> // For mbstate_t +#include <bits/stringfwd.h> // For string forward declarations. -namespace std { - - // Generic declarations. - template<typename _CharT> struct char_traits; - template<typename _Alloc> class allocator; - +namespace std +{ // Forward declarations template<> class char_traits<char>; #ifdef _GLIBCPP_USE_WCHAR_T @@ -50,53 +47,53 @@ namespace std { #endif template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_ios; + class basic_ios; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_streambuf; + class basic_streambuf; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_istream; + class basic_istream; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_ostream; + class basic_ostream; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_iostream; + class basic_iostream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > - class basic_stringbuf; + class basic_stringbuf; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > - class basic_istringstream; + class basic_istringstream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > - class basic_ostringstream; + class basic_ostringstream; template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > - class basic_stringstream; + class basic_stringstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_filebuf; + class basic_filebuf; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_ifstream; + class basic_ifstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_ofstream; + class basic_ofstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class basic_fstream; + class basic_fstream; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class istreambuf_iterator; + class istreambuf_iterator; template<typename _CharT, typename _Traits = char_traits<_CharT> > - class ostreambuf_iterator; + class ostreambuf_iterator; #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS // Not included. @@ -144,14 +141,6 @@ namespace std { typedef basic_ofstream<wchar_t> wofstream; typedef basic_fstream<wchar_t> 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 <exception> - -#if defined(__STL_USE_EXCEPTIONS) || \ - !(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32) - -#include <bits/stl_string_fwd.h> - -__STL_BEGIN_NAMESPACE - -class __Named_exception : public exception { -public: - __Named_exception(const string& __str); - virtual const char* what() const __STL_NOTHROW { return _M_name; } - -private: - enum { _S_bufsize = 256 }; - char _M_name[_S_bufsize]; -}; - -class logic_error : public __Named_exception { -public: - logic_error(const string& __s) : __Named_exception(__s) {} -}; - -class runtime_error : public __Named_exception { -public: - runtime_error(const string& __s) : __Named_exception(__s) {} -}; - -class domain_error : public logic_error { -public: - domain_error(const string& __arg) : logic_error(__arg) {} -}; - -class invalid_argument : public logic_error { -public: - invalid_argument(const string& __arg) : logic_error(__arg) {} -}; - -class length_error : public logic_error { -public: - length_error(const string& __arg) : logic_error(__arg) {} -}; - -class out_of_range : public logic_error { -public: - out_of_range(const string& __arg) : logic_error(__arg) {} -}; - -class range_error : public runtime_error { -public: - range_error(const string& __arg) : runtime_error(__arg) {} -}; - -class overflow_error : public runtime_error { -public: - overflow_error(const string& __arg) : runtime_error(__arg) {} -}; - -class underflow_error : public runtime_error { -public: - underflow_error(const string& __arg) : runtime_error(__arg) {} -}; - -__STL_END_NAMESPACE - -#endif /* Not o32, and no exceptions */ - -#endif /* _CPP_STDEXCEPT */ - -// Local Variables: -// mode:C++ -// End: - +#include <bits/stringfwd.h> + +namespace std +{ + class logic_error : public exception + { + const string& _M_msg; + + public: + explicit + logic_error(const string& __arg); + + virtual + ~logic_error() throw(); + + virtual const char* + what() const throw(); + }; + + class domain_error : public logic_error + { + public: + explicit domain_error(const string& __arg); + }; + + class invalid_argument : public logic_error + { + public: + explicit invalid_argument(const string& __arg); + }; + + class length_error : public logic_error + { + public: + explicit length_error(const string& __arg); + }; + + class out_of_range : public logic_error + { + public: + explicit out_of_range(const string& __arg); + }; + + class runtime_error : public exception + { + const string& _M_msg; + + public: + explicit + runtime_error(const string& __arg); + + virtual + ~runtime_error() throw(); + + virtual const char* + what() const throw(); + }; + + class range_error : public runtime_error + { + public: + explicit range_error(const string& __arg); + }; + + class overflow_error : public runtime_error + { + public: + explicit overflow_error(const string& __arg); + }; + + 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 <bits/c++config.h> -#include <bits/stl_string_fwd.h> -#include <bits/std_iterator.h> +#include <bits/stringfwd.h> #include <bits/char_traits.h> +#include <bits/std_iterator.h> +#include <bits/std_memory.h> // For allocator. #include <bits/type_traits.h> -#include <bits/std_iosfwd.h> // for operators >>, <<, and getline decls +#include <bits/std_iosfwd.h> // For operators >>, <<, and getline decls. #include <bits/basic_string.h> #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 <bits/stl_config.h> -#include <bits/stl_alloc.h> -#include <bits/char_traits.h> - -__STL_BEGIN_NAMESPACE - -template <class _CharT, - class _Traits = char_traits<_CharT>, - class _Alloc = allocator<_CharT> > -class basic_string; - -typedef basic_string<char> string; -#ifdef _GLIBCPP_USE_WCHAR_T -typedef basic_string<wchar_t> 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 <bits/c++config.h> + +namespace std +{ + template<class _CharT> + struct char_traits; + + template<typename _Alloc> + class allocator; + + template<typename _CharT, typename _Traits = char_traits<_CharT>, + typename _Alloc = allocator<_CharT> > + class basic_string; + + typedef basic_string<char> string; +#ifdef _GLIBCPP_USE_WCHAR_T + typedef basic_string<wchar_t> wstring; +#endif +} // namespace std + +#endif // _CPP_BITS_STRINGFWD_H + +// Local Variables: +// mode:c++ +// End: |