This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

[Patch] libstdc++/9580


Hi,

the below fixes the compilation error that Pétur was seeing by
consistently changing the generic definitions of underflow and
uflow to do nothing and adding the specializations for char
and wchar_t: we do *not* have a generic _M_underflow_common
which generic underflow and uflow can use!

Tested x86-linux.

Is this the best we can do right now?

Paolo.

////////////
2003-02-13  Paolo Carlini  <pcarlini@unitus.it>

	PR libstdc++/9580
	* include/std/std_fstream.h: Declare underflow and uflow
	specializations, change generic definitions to do nothing.
	* src/fstream.cc: Add underflow and uflow specializations.
diff -urN libstdc++-v3-orig/include/std/std_fstream.h libstdc++-v3/include/std/std_fstream.h
--- libstdc++-v3-orig/include/std/std_fstream.h	2003-01-23 19:56:00.000000000 +0100
+++ libstdc++-v3/include/std/std_fstream.h	2003-02-13 23:49:57.000000000 +0100
@@ -439,23 +439,38 @@
     basic_filebuf<char>::int_type 
     basic_filebuf<char>::_M_underflow_common(bool __bump);
 
+  template<>
+    basic_filebuf<char>::int_type
+    basic_filebuf<char>::underflow(); 
+
+  template<>
+    basic_filebuf<char>::int_type
+    basic_filebuf<char>::uflow(); 
+
  #ifdef _GLIBCPP_USE_WCHAR_T
   template<> 
     basic_filebuf<wchar_t>::int_type 
     basic_filebuf<wchar_t>::_M_underflow_common(bool __bump);
+
+  template<>
+    basic_filebuf<wchar_t>::int_type
+    basic_filebuf<wchar_t>::underflow(); 
+
+  template<>
+    basic_filebuf<wchar_t>::int_type
+    basic_filebuf<wchar_t>::uflow(); 
  #endif
 
-  // Generic definitions.
+  // Generic definitions do nothing.
   template <typename _CharT, typename _Traits>
     typename basic_filebuf<_CharT, _Traits>::int_type
     basic_filebuf<_CharT, _Traits>::underflow() 
-    { return _M_underflow_common(false); }
+    { return int_type(); }
 
   template <typename _CharT, typename _Traits>
     typename basic_filebuf<_CharT, _Traits>::int_type
     basic_filebuf<_CharT, _Traits>::uflow() 
-    { return _M_underflow_common(true); }
-
+    { return int_type(); }
 
   // [27.8.1.5] Template class basic_ifstream
   /**
diff -urN libstdc++-v3-orig/src/fstream.cc libstdc++-v3/src/fstream.cc
--- libstdc++-v3-orig/src/fstream.cc	2002-07-31 22:48:38.000000000 +0200
+++ libstdc++-v3/src/fstream.cc	2003-02-13 23:32:16.000000000 +0100
@@ -100,6 +100,16 @@
       return __ret;
     }
 
+  template<>
+    basic_filebuf<char>::int_type
+    basic_filebuf<char>::underflow() 
+    { return _M_underflow_common(false); }
+
+  template<>
+    basic_filebuf<char>::int_type
+    basic_filebuf<char>::uflow() 
+    { return _M_underflow_common(true); }
+
 #ifdef _GLIBCPP_USE_WCHAR_T
   template<> 
     basic_filebuf<wchar_t>::int_type 
@@ -189,5 +199,15 @@
       _M_last_overflowed = false;	
       return __ret;
     }
+
+  template<>
+    basic_filebuf<wchar_t>::int_type
+    basic_filebuf<wchar_t>::underflow() 
+    { return _M_underflow_common(false); }
+
+  template<>
+    basic_filebuf<wchar_t>::int_type
+    basic_filebuf<wchar_t>::uflow() 
+    { return _M_underflow_common(true); }
 #endif
 } // namespace std

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