public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* namespace std in libstdc++
@ 1998-05-09  3:34 Martin von Loewis
  0 siblings, 0 replies; only message in thread
From: Martin von Loewis @ 1998-05-09  3:34 UTC (permalink / raw)
  To: egcs

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  <loewis@informatik.hu-berlin.de>

	* 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<iterator> reverse_iterator;
-  typedef ::reverse_iterator<const_iterator> const_reverse_iterator;
+  typedef std::reverse_iterator<iterator> reverse_iterator;
+  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
   static const size_type npos = static_cast<size_type>(-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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-05-09  3:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-09  3:34 namespace std in libstdc++ Martin von Loewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).