This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[v3, 4_2] Adjust __ostream_insert extern template declaration


Hi,

tested x86-linux, committed to the branch.

Paolo.

////////////////
2007-05-24  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/ostream.tcc: Do not inhibit implicit instantiation
	of __ostream_insert here...
	* include/bits/ostream_insert.h: ... do it here.
Index: include/bits/ostream.tcc
===================================================================
--- include/bits/ostream.tcc	(revision 125033)
+++ include/bits/ostream.tcc	(working copy)
@@ -334,7 +334,6 @@
   extern template ostream& operator<<(ostream&, const char*);
   extern template ostream& operator<<(ostream&, const unsigned char*);
   extern template ostream& operator<<(ostream&, const signed char*);
-  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
 
   extern template ostream& ostream::_M_insert(long);
   extern template ostream& ostream::_M_insert(unsigned long);
@@ -356,8 +355,6 @@
   extern template wostream& operator<<(wostream&, char);
   extern template wostream& operator<<(wostream&, const wchar_t*);
   extern template wostream& operator<<(wostream&, const char*);
-  extern template wostream& __ostream_insert(wostream&, const wchar_t*,
-					     streamsize);
 
   extern template wostream& wostream::_M_insert(long);
   extern template wostream& wostream::_M_insert(unsigned long);
Index: include/bits/ostream_insert.h
===================================================================
--- include/bits/ostream_insert.h	(revision 125033)
+++ include/bits/ostream_insert.h	(working copy)
@@ -109,6 +109,18 @@
       return __out;
     }
 
+  // Inhibit implicit instantiations for required instantiations,
+  // which are defined via explicit instantiations elsewhere.
+  // NB:  This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  extern template wostream& __ostream_insert(wostream&, const wchar_t*,
+					     streamsize);
+#endif
+#endif
+
 _GLIBCXX_END_NAMESPACE
 
 #endif /* _OSTREAM_INSERT_H */

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