This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Revised patch


When trying to link an application, I ran into a few problems with my
previous patch: __length_error and __out_of_range are declared in
std::.

Also, in <iostream>, an instance of Init is created, which should be
std:: scoped. What I don't understand: Why is that instance created at
all? It is not required by ISO C++, is it?

With this patch, and two hacks (regarding clog, and ::isspace), I
could eventually build a DIN C++ compliant "Hello world" application
:-)

Martin

1999-04-16  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* src/complex.cc (FCT): Qualify all functions with global namespace.
	* src/locale.cc: Don't qualify memcpy and setlocale.
	* src/stdexcept.cc (__out_of_range, __length_error): Wrap in std::.
	* src/stlinst.cc: Qualify instantiations with std::.

Index: bits/std_cmath.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/std_cmath.h,v
retrieving revision 1.4
diff -u -r1.4 std_cmath.h
--- std_cmath.h	1999/04/14 16:39:36	1.4
+++ std_cmath.h	1999/04/16 07:50:39
@@ -36,12 +36,12 @@
 #ifndef _CPP_CMATH
 #define _CPP_CMATH 1
 # include_next <math.h>
+# include_next <stdlib.h>
 
 namespace std {
     
     inline long abs(long l) { return ::labs(l); }
     inline ldiv_t div(long a, long b) { return ldiv(a, b); }
-
     inline double abs(double x) { return fabs(x); }
     
 } // std
Index: src/basic_file.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/src/basic_file.cc,v
retrieving revision 1.12
diff -u -r1.12 basic_file.cc
--- basic_file.cc	1999/04/13 12:39:44	1.12
+++ basic_file.cc	1999/04/16 07:50:40
@@ -140,7 +140,9 @@
     if ( !_IO_file_is_open(this))
       {
 #if _G_HAVE_IO_FILE_OPEN
-	__retval = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0);
+ 	__c_file_type *__f;
+ 	__f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0);
+ 	__retval = __f ? this: NULL;
 #else
 	int __i = ::open(__name, __p_mode, __prot);
 	if (__i >= 0)
Index: src/locale.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/src/locale.cc,v
retrieving revision 1.21
diff -u -r1.21 locale.cc
--- locale.cc	1999/04/13 14:09:35	1.21
+++ locale.cc	1999/04/16 07:50:41
@@ -300,7 +300,7 @@
     _S_global->_M_remove_reference();
     _S_global = __other._M_impl; 
     if (_S_global->_M_has_name)
-      std::setlocale(LC_ALL, __other.name().c_str());
+      setlocale(LC_ALL, __other.name().c_str());
     return __keep;
   }
 
@@ -515,7 +515,7 @@
   ctype<char>::
   do_widen(const char* __low, const char* __high, char* __dest) const
   {
-    std::memcpy(__dest, __low, __high - __low);
+    memcpy(__dest, __low, __high - __low);
     return __high;
   }
   
@@ -530,7 +530,7 @@
   do_narrow(const char* __low, const char* __high, char __dfault,
 	    char* __dest) const
   {
-    std::memcpy(__dest, __low, __high - __low);
+    memcpy(__dest, __low, __high - __low);
     return __high;
   }
 
Index: src/stdexcept.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/src/stdexcept.cc,v
retrieving revision 1.9
diff -u -r1.9 stdexcept.cc
--- stdexcept.cc	1999/03/12 02:49:18	1.9
+++ stdexcept.cc	1999/04/16 07:50:41
@@ -40,6 +40,8 @@
 // To break the circularity with the <stdexcept> and <string> header we
 // define two functions which throw exceptions as a direct call would do.
 
+namespace std{
+
 void
 __out_of_range (const char *str)
 {
@@ -50,6 +52,8 @@
 void __length_error (const char *str)
 {
   throw length_error (str);
+}
+
 }
 
 #if 0
Index: src/stlinst.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/src/stlinst.cc,v
retrieving revision 1.2
diff -u -r1.2 stlinst.cc
--- stlinst.cc	1999/02/10 01:00:03	1.2
+++ stlinst.cc	1999/04/16 07:50:41
@@ -2,6 +2,8 @@
 #include <bits/stl_config.h>
 #include <bits/stl_alloc.h>
 
-template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>;
+template class  std::__malloc_alloc_template<0>;
 
-template class  __malloc_alloc_template<0>;
+template class std::__default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>;
+
+
Index: std/iostream
===================================================================
RCS file: /cvs/libstdc++/libstdc++/std/iostream,v
retrieving revision 1.3
diff -u -r1.3 iostream
--- iostream	1999/03/12 02:49:19	1.3
+++ iostream	1999/04/16 07:50:41
@@ -2,4 +2,4 @@
 #include <bits/std_iostream.h>
 #endif
 
-  static ios_base::Init __ioinit;
+  static std::ios_base::Init __ioinit;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]