libstdc++/8318

Benjamin Kosnik bkoz@redhat.com
Fri Nov 1 09:21:00 GMT 2002


tested x86/linux

2002-11-01  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/8318
	* include/std/std_iostream.h: Tweak.
	* include/std/std_iosfwd.h: Add _GLIBCPP_USE_WCHAR_T.
	* include/std/std_iomanip.h: Same.
	* include/bits/stringfwd.h: Same.
	* include/bits/basic_string.tcc: Same.
	* include/bits/sstream.tcc: Same.
	* include/bits/fstream.tcc: Same.
	* include/bits/basic_ios.tcc: Same.
	* include/bits/streambuf.tcc: Same.
	* include/bits/locale_facets.tcc: Same.

Index: include/bits/basic_ios.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/basic_ios.tcc,v
retrieving revision 1.16
diff -c -p -r1.16 basic_ios.tcc
*** include/bits/basic_ios.tcc	4 Jul 2002 09:20:00 -0000	1.16
--- include/bits/basic_ios.tcc	1 Nov 2002 17:19:43 -0000
*************** namespace std
*** 187,193 ****
--- 187,196 ----
    // which are defined via explicit instantiations elsewhere.  
    // NB:  This syntax is a GNU extension.
    extern template class basic_ios<char>;
+ 
+ #ifdef _GLIBCPP_USE_WCHAR_T
    extern template class basic_ios<wchar_t>;
+ #endif
  } // namespace std
  
  #endif 
Index: include/bits/basic_string.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/basic_string.tcc,v
retrieving revision 1.27
diff -c -p -r1.27 basic_string.tcc
*** include/bits/basic_string.tcc	1 Nov 2002 15:21:17 -0000	1.27
--- include/bits/basic_string.tcc	1 Nov 2002 17:19:44 -0000
*************** namespace std
*** 959,964 ****
--- 959,965 ----
      basic_istream<char>& 
      getline(basic_istream<char>&, string&);
  
+ #ifdef _GLIBCPP_USE_WCHAR_T
    extern template class basic_string<wchar_t>;
    extern template 
      basic_istream<wchar_t>& 
*************** namespace std
*** 972,977 ****
--- 973,979 ----
    extern template 
      basic_istream<wchar_t>& 
      getline(basic_istream<wchar_t>&, wstring&);
+ #endif
  } // namespace std
  
  #endif
Index: include/bits/fstream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/fstream.tcc,v
retrieving revision 1.40
diff -c -p -r1.40 fstream.tcc
*** include/bits/fstream.tcc	15 Aug 2002 22:25:38 -0000	1.40
--- include/bits/fstream.tcc	1 Nov 2002 17:19:46 -0000
*************** namespace std
*** 477,489 ****
    // which are defined via explicit instantiations elsewhere.  
    // NB:  This syntax is a GNU extension.
    extern template class basic_filebuf<char>;
-   extern template class basic_filebuf<wchar_t>;
    extern template class basic_ifstream<char>;
-   extern template class basic_ifstream<wchar_t>;
    extern template class basic_ofstream<char>;
-   extern template class basic_ofstream<wchar_t>;
    extern template class basic_fstream<char>;
    extern template class basic_fstream<wchar_t>;
  } // namespace std
  
  #endif 
--- 477,492 ----
    // which are defined via explicit instantiations elsewhere.  
    // NB:  This syntax is a GNU extension.
    extern template class basic_filebuf<char>;
    extern template class basic_ifstream<char>;
    extern template class basic_ofstream<char>;
    extern template class basic_fstream<char>;
+ 
+ #ifdef _GLIBCPP_USE_WCHAR_T
+   extern template class basic_filebuf<wchar_t>;
+   extern template class basic_ifstream<wchar_t>;
+   extern template class basic_ofstream<wchar_t>;
    extern template class basic_fstream<wchar_t>;
+ #endif
  } // namespace std
  
  #endif 
Index: include/bits/locale_facets.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.81
diff -c -p -r1.81 locale_facets.tcc
*** include/bits/locale_facets.tcc	27 Sep 2002 23:08:21 -0000	1.81
--- include/bits/locale_facets.tcc	1 Nov 2002 17:19:47 -0000
*************** namespace std
*** 2140,2181 ****
    extern template class moneypunct_byname<char, true>;
    extern template class money_get<char>;
    extern template class money_put<char>;
-   extern template class moneypunct<wchar_t, false>;
-   extern template class moneypunct<wchar_t, true>;
-   extern template class moneypunct_byname<wchar_t, false>;
-   extern template class moneypunct_byname<wchar_t, true>;
-   extern template class money_get<wchar_t>;
-   extern template class money_put<wchar_t>;
    extern template class numpunct<char>;
    extern template class numpunct_byname<char>;
    extern template class num_get<char>;
    extern template class num_put<char>; 
-   extern template class numpunct<wchar_t>;
-   extern template class numpunct_byname<wchar_t>;
-   extern template class num_get<wchar_t>;
-   extern template class num_put<wchar_t>;
    extern template class __timepunct<char>;
    extern template class time_put<char>;
    extern template class time_put_byname<char>;
    extern template class time_get<char>;
    extern template class time_get_byname<char>;
-   extern template class __timepunct<wchar_t>;
-   extern template class time_put<wchar_t>;
-   extern template class time_put_byname<wchar_t>;
-   extern template class time_get<wchar_t>;
-   extern template class time_get_byname<wchar_t>;
    extern template class messages<char>;
    extern template class messages_byname<char>;
-   extern template class messages<wchar_t>;
-   extern template class messages_byname<wchar_t>;
    extern template class ctype_byname<char>;
-   extern template class ctype_byname<wchar_t>;
    extern template class codecvt_byname<char, char, mbstate_t>;
-   extern template class codecvt_byname<wchar_t, char, mbstate_t>;
    extern template class collate<char>;
    extern template class collate_byname<char>;
-   extern template class collate<wchar_t>;
-   extern template class collate_byname<wchar_t>;
  
    extern template
      const codecvt<char, char, mbstate_t>& 
--- 2140,2160 ----
*************** namespace std
*** 2229,2287 ****
      const messages<char>& 
      use_facet<messages<char> >(const locale&);
  
-   extern template
-     const codecvt<wchar_t, char, mbstate_t>& 
-     use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
- 
-   extern template
-     const collate<wchar_t>& 
-     use_facet<collate<wchar_t> >(const locale&);
- 
-   extern template
-     const numpunct<wchar_t>& 
-     use_facet<numpunct<wchar_t> >(const locale&);
- 
-   extern template 
-     const num_put<wchar_t>& 
-     use_facet<num_put<wchar_t> >(const locale&);
- 
-   extern template 
-     const num_get<wchar_t>& 
-     use_facet<num_get<wchar_t> >(const locale&);
- 
-   extern template
-     const moneypunct<wchar_t, true>& 
-     use_facet<moneypunct<wchar_t, true> >(const locale&);
- 
-   extern template
-     const moneypunct<wchar_t, false>& 
-     use_facet<moneypunct<wchar_t, false> >(const locale&);
-  
-   extern template 
-     const money_put<wchar_t>& 
-     use_facet<money_put<wchar_t> >(const locale&);
- 
-   extern template 
-     const money_get<wchar_t>& 
-     use_facet<money_get<wchar_t> >(const locale&);
- 
-   extern template
-     const __timepunct<wchar_t>& 
-     use_facet<__timepunct<wchar_t> >(const locale&);
- 
-   extern template 
-     const time_put<wchar_t>& 
-     use_facet<time_put<wchar_t> >(const locale&);
- 
-   extern template 
-     const time_get<wchar_t>& 
-     use_facet<time_get<wchar_t> >(const locale&);
- 
-   extern template 
-     const messages<wchar_t>& 
-     use_facet<messages<wchar_t> >(const locale&);
- 
- 
    extern template 
      bool
      has_facet<ctype<char> >(const locale&);
--- 2208,2213 ----
*************** namespace std
*** 2334,2339 ****
--- 2260,2340 ----
      bool
      has_facet<messages<char> >(const locale&);
  
+ #ifdef _GLIBCPP_USE_WCHAR_T
+   extern template class moneypunct<wchar_t, false>;
+   extern template class moneypunct<wchar_t, true>;
+   extern template class moneypunct_byname<wchar_t, false>;
+   extern template class moneypunct_byname<wchar_t, true>;
+   extern template class money_get<wchar_t>;
+   extern template class money_put<wchar_t>;
+   extern template class numpunct<wchar_t>;
+   extern template class numpunct_byname<wchar_t>;
+   extern template class num_get<wchar_t>;
+   extern template class num_put<wchar_t>;
+   extern template class __timepunct<wchar_t>;
+   extern template class time_put<wchar_t>;
+   extern template class time_put_byname<wchar_t>;
+   extern template class time_get<wchar_t>;
+   extern template class time_get_byname<wchar_t>;
+   extern template class messages<wchar_t>;
+   extern template class messages_byname<wchar_t>;
+   extern template class ctype_byname<wchar_t>;
+   extern template class codecvt_byname<wchar_t, char, mbstate_t>;
+   extern template class collate<wchar_t>;
+   extern template class collate_byname<wchar_t>;
+ 
+   extern template
+     const codecvt<wchar_t, char, mbstate_t>& 
+     use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
+ 
+   extern template
+     const collate<wchar_t>& 
+     use_facet<collate<wchar_t> >(const locale&);
+ 
+   extern template
+     const numpunct<wchar_t>& 
+     use_facet<numpunct<wchar_t> >(const locale&);
+ 
+   extern template 
+     const num_put<wchar_t>& 
+     use_facet<num_put<wchar_t> >(const locale&);
+ 
+   extern template 
+     const num_get<wchar_t>& 
+     use_facet<num_get<wchar_t> >(const locale&);
+ 
+   extern template
+     const moneypunct<wchar_t, true>& 
+     use_facet<moneypunct<wchar_t, true> >(const locale&);
+ 
+   extern template
+     const moneypunct<wchar_t, false>& 
+     use_facet<moneypunct<wchar_t, false> >(const locale&);
+  
+   extern template 
+     const money_put<wchar_t>& 
+     use_facet<money_put<wchar_t> >(const locale&);
+ 
+   extern template 
+     const money_get<wchar_t>& 
+     use_facet<money_get<wchar_t> >(const locale&);
+ 
+   extern template
+     const __timepunct<wchar_t>& 
+     use_facet<__timepunct<wchar_t> >(const locale&);
+ 
+   extern template 
+     const time_put<wchar_t>& 
+     use_facet<time_put<wchar_t> >(const locale&);
+ 
+   extern template 
+     const time_get<wchar_t>& 
+     use_facet<time_get<wchar_t> >(const locale&);
+ 
+   extern template 
+     const messages<wchar_t>& 
+     use_facet<messages<wchar_t> >(const locale&);
+ 
   extern template 
      bool
      has_facet<ctype<wchar_t> >(const locale&);
*************** namespace std
*** 2385,2390 ****
--- 2386,2392 ----
    extern template 
      bool
      has_facet<messages<wchar_t> >(const locale&);
+ #endif
  } // namespace std
  
  #endif
Index: include/bits/sstream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/sstream.tcc,v
retrieving revision 1.12
diff -c -p -r1.12 sstream.tcc
*** include/bits/sstream.tcc	31 Jul 2002 02:47:33 -0000	1.12
--- include/bits/sstream.tcc	1 Nov 2002 17:19:48 -0000
*************** namespace std
*** 226,238 ****
    // which are defined via explicit instantiations elsewhere.  
    // NB:  This syntax is a GNU extension.
    extern template class basic_stringbuf<char>;
-   extern template class basic_stringbuf<wchar_t>;
    extern template class basic_istringstream<char>;
-   extern template class basic_istringstream<wchar_t>;
    extern template class basic_ostringstream<char>;
-   extern template class basic_ostringstream<wchar_t>;
    extern template class basic_stringstream<char>;
    extern template class basic_stringstream<wchar_t>;
  } // namespace std
  
  #endif
--- 226,241 ----
    // which are defined via explicit instantiations elsewhere.  
    // NB:  This syntax is a GNU extension.
    extern template class basic_stringbuf<char>;
    extern template class basic_istringstream<char>;
    extern template class basic_ostringstream<char>;
    extern template class basic_stringstream<char>;
+ 
+ #ifdef _GLIBCPP_USE_WCHAR_T
+   extern template class basic_stringbuf<wchar_t>;
+   extern template class basic_istringstream<wchar_t>;
+   extern template class basic_ostringstream<wchar_t>;
    extern template class basic_stringstream<wchar_t>;
+ #endif
  } // namespace std
  
  #endif
Index: include/bits/streambuf.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/streambuf.tcc,v
retrieving revision 1.16
diff -c -p -r1.16 streambuf.tcc
*** include/bits/streambuf.tcc	9 Oct 2002 06:32:11 -0000	1.16
--- include/bits/streambuf.tcc	1 Nov 2002 17:19:49 -0000
*************** namespace std 
*** 249,259 ****
--- 249,261 ----
      __copy_streambufs(basic_ios<char>&, basic_streambuf<char>*,
  		      basic_streambuf<char>*); 
  
+ #ifdef _GLIBCPP_USE_WCHAR_T
    extern template class basic_streambuf<wchar_t>;
    extern template
      streamsize
      __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,
  		      basic_streambuf<wchar_t>*); 
+ #endif
  } // namespace std
  
  #endif 
Index: include/bits/stringfwd.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stringfwd.h,v
retrieving revision 1.7
diff -c -p -r1.7 stringfwd.h
*** include/bits/stringfwd.h	1 Sep 2002 00:33:53 -0000	1.7
--- include/bits/stringfwd.h	1 Nov 2002 17:19:49 -0000
***************
*** 45,69 ****
  
  namespace std
  {
-   template<class _CharT>
-     struct char_traits;
-   
-   template<> struct char_traits<char>;
- #ifdef _GLIBCPP_USE_WCHAR_T
-   template<> struct char_traits<wchar_t>;
- #endif
- 
    template<typename _Alloc> 
      class allocator;
  
    template<typename _CharT, typename _Traits = char_traits<_CharT>, 
             typename _Alloc = allocator<_CharT> >
      class basic_string;
  
-   /// 99%% of %string users only ever [need to] see the typedef.
    typedef basic_string<char>    string;
!   /// 99%% of %wstring users only ever [need to] see the typedef.
    typedef basic_string<wchar_t> wstring;
  } // namespace std
  
  #endif	// _CPP_BITS_STRINGFWD_H
--- 45,69 ----
  
  namespace std
  {
    template<typename _Alloc> 
      class allocator;
  
+   template<class _CharT>
+     struct char_traits;
+ 
    template<typename _CharT, typename _Traits = char_traits<_CharT>, 
             typename _Alloc = allocator<_CharT> >
      class basic_string;
+   
+   template<> struct char_traits<char>;
  
    typedef basic_string<char>    string;
! 
! #ifdef _GLIBCPP_USE_WCHAR_T
!   template<> struct char_traits<wchar_t>;
! 
    typedef basic_string<wchar_t> wstring;
+ #endif
  } // namespace std
  
  #endif	// _CPP_BITS_STRINGFWD_H
Index: include/std/std_iomanip.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_iomanip.h,v
retrieving revision 1.4
diff -c -p -r1.4 std_iomanip.h
*** include/std/std_iomanip.h	20 Feb 2002 00:58:13 -0000	1.4
--- include/std/std_iomanip.h	1 Nov 2002 17:19:49 -0000
*************** namespace std
*** 225,249 ****
    extern template ostream& operator<<(ostream&, _Setbase);
    extern template ostream& operator<<(ostream&, _Setprecision);
    extern template ostream& operator<<(ostream&, _Setw);
-   extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
-   extern template wostream& operator<<(wostream&, _Setiosflags);
-   extern template wostream& operator<<(wostream&, _Resetiosflags);
-   extern template wostream& operator<<(wostream&, _Setbase);
-   extern template wostream& operator<<(wostream&, _Setprecision);
-   extern template wostream& operator<<(wostream&, _Setw);
- 
    extern template istream& operator>>(istream&, _Setfill<char>);
    extern template istream& operator>>(istream&, _Setiosflags);
    extern template istream& operator>>(istream&, _Resetiosflags);
    extern template istream& operator>>(istream&, _Setbase);
    extern template istream& operator>>(istream&, _Setprecision);
    extern template istream& operator>>(istream&, _Setw);
    extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
    extern template wistream& operator>>(wistream&, _Setiosflags);
    extern template wistream& operator>>(wistream&, _Resetiosflags);
    extern template wistream& operator>>(wistream&, _Setbase);
    extern template wistream& operator>>(wistream&, _Setprecision);
    extern template wistream& operator>>(wistream&, _Setw);
  } // namespace std
  
  #endif	
--- 225,251 ----
    extern template ostream& operator<<(ostream&, _Setbase);
    extern template ostream& operator<<(ostream&, _Setprecision);
    extern template ostream& operator<<(ostream&, _Setw);
    extern template istream& operator>>(istream&, _Setfill<char>);
    extern template istream& operator>>(istream&, _Setiosflags);
    extern template istream& operator>>(istream&, _Resetiosflags);
    extern template istream& operator>>(istream&, _Setbase);
    extern template istream& operator>>(istream&, _Setprecision);
    extern template istream& operator>>(istream&, _Setw);
+ 
+ #ifdef _GLIBCPP_USE_WCHAR_T
+   extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
+   extern template wostream& operator<<(wostream&, _Setiosflags);
+   extern template wostream& operator<<(wostream&, _Resetiosflags);
+   extern template wostream& operator<<(wostream&, _Setbase);
+   extern template wostream& operator<<(wostream&, _Setprecision);
+   extern template wostream& operator<<(wostream&, _Setw);
    extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
    extern template wistream& operator>>(wistream&, _Setiosflags);
    extern template wistream& operator>>(wistream&, _Resetiosflags);
    extern template wistream& operator>>(wistream&, _Setbase);
    extern template wistream& operator>>(wistream&, _Setprecision);
    extern template wistream& operator>>(wistream&, _Setw);
+ #endif
  } // namespace std
  
  #endif	
Index: include/std/std_iosfwd.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_iosfwd.h,v
retrieving revision 1.3
diff -c -p -r1.3 std_iosfwd.h
*** include/std/std_iosfwd.h	16 Feb 2002 02:41:10 -0000	1.3
--- include/std/std_iosfwd.h	1 Nov 2002 17:19:49 -0000
*************** namespace std 
*** 116,121 ****
--- 116,122 ----
    typedef basic_ofstream<char> 		ofstream;
    typedef basic_fstream<char> 		fstream;
  
+ #ifdef _GLIBCPP_USE_WCHAR_T
    typedef basic_ios<wchar_t> 		wios;
    typedef basic_streambuf<wchar_t> 	wstreambuf;
    typedef basic_istream<wchar_t> 	wistream;
*************** namespace std 
*** 129,134 ****
--- 130,136 ----
    typedef basic_ifstream<wchar_t> 	wifstream;
    typedef basic_ofstream<wchar_t> 	wofstream;
    typedef basic_fstream<wchar_t> 	wfstream;
+ #endif
  } // namespace std
  
  #endif
Index: include/std/std_iostream.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_iostream.h,v
retrieving revision 1.2
diff -c -p -r1.2 std_iostream.h
*** include/std/std_iostream.h	28 Jan 2002 22:13:10 -0000	1.2
--- include/std/std_iostream.h	1 Nov 2002 17:19:49 -0000
*************** namespace std 
*** 51,56 ****
--- 51,57 ----
    extern ostream cout;
    extern ostream cerr;
    extern ostream clog;
+ 
  #ifdef _GLIBCPP_USE_WCHAR_T
    extern wistream wcin;
    extern wostream wcout;



More information about the Gcc-patches mailing list