From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin von Loewis To: egcs@cygnus.com Subject: namespace std in libstdc++ Date: Sat, 09 May 1998 03:34:00 -0000 Message-id: <199805090839.KAA19178@mira.isdn.cs.tu-berlin.de> X-SW-Source: 1998-05/msg00316.html This patch adds 'namespace std' to several places in libstdc++. It is only a minimal change: - std is enabled for STL, which already provides this as a configuration option. - std is added to stdexcept, like the exceptions used by the language runtime (e.g. std::bad_alloc). - std qualification is added to places where it was missing. With current egcs, these changes are not noticable unless g++ is invoked with -fnew-abi. As this option suggests, enabling it really results in binary incompatibility, as the mangling for std:: qualified types will be different. I'm aware that std scoping is missing in many more places, but I hope that will be provided in the upcoming rewrite of libstdc++. Martin Sat May 9 09:32:20 1998 Martin von Loewis * stdexcept: Conditionally wrap into namespace std. * stl/stl_config.h: Likewise, for gcc 2.8 or better. * stdexcepti.cc (__out_of_range, __length_error): Qualify standard exception classes with std::. * bastring.h: Qualify iterator templates with std::. Index: stdexcept =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stdexcept,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 stdexcept --- stdexcept 1997/08/21 22:58:34 1.1.1.1 +++ stdexcept 1998/05/09 07:45:21 @@ -37,6 +37,10 @@ extern "C++" { +#ifdef __HONOR_STD +namespace std { +#endif + class logic_error : public exception { string _what; public: @@ -87,6 +91,10 @@ class underflow_error : public runtime_e public: underflow_error (const string& what_arg): runtime_error (what_arg) { } }; + +#ifdef __HONOR_STD +} // namespace std +#endif } // extern "C++" Index: stdexcepti.cc =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stdexcepti.cc,v retrieving revision 1.2 diff -u -p -r1.2 stdexcepti.cc --- stdexcepti.cc 1997/10/10 06:56:52 1.2 +++ stdexcepti.cc 1998/05/09 07:45:21 @@ -12,10 +12,10 @@ void __out_of_range (const char *s) { - throw out_of_range (s); + throw std::out_of_range (s); } void __length_error (const char *s) { - throw length_error (s); + throw std::length_error (s); } Index: std/bastring.h =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/std/bastring.h,v retrieving revision 1.11 diff -u -p -r1.11 bastring.h --- bastring.h 1998/01/25 16:45:02 1.11 +++ bastring.h 1998/05/09 07:45:21 @@ -105,8 +105,8 @@ public: typedef const charT* const_pointer; typedef pointer iterator; typedef const_pointer const_iterator; - typedef ::reverse_iterator reverse_iterator; - typedef ::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; static const size_type npos = static_cast(-1); private: Index: stl/stl_config.h =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/stl_config.h,v retrieving revision 1.5 diff -u -p -r1.5 stl_config.h --- stl_config.h 1998/02/20 11:13:42 1.5 +++ stl_config.h 1998/05/09 07:45:22 @@ -113,6 +113,9 @@ # define __STL_FUNCTION_TMPL_PARTIAL_ORDER # define __STL_EXPLICIT_FUNCTION_TMPL_ARGS # define __STL_MEMBER_TEMPLATES +# if defined(__HONOR_STD) +# define __STL_USE_NAMESPACES +# endif # endif # if !defined(_NOTHREADS) && __GLIBC__ >= 2 # define __STL_PTHREADS