c++config (_GLIBCPP_EXTERN_TEMPLATE): Define.
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 13 Feb 2003 21:39:03 +0000 (21:39 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 13 Feb 2003 21:39:03 +0000 (21:39 +0000)
2003-02-13  Benjamin Kosnik  <bkoz@redhat.com>

* include/bits/c++config (_GLIBCPP_EXTERN_TEMPLATE): Define.
* include/bits/basic_ios.tcc: Guard use of extern template.
* include/std/std_iomanip.h: Same.
* include/bits/streambuf.tcc: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/bits/ostream.tcc: Same.
* include/bits/istream.tcc: Same.
* include/bits/fstream.tcc: Same.
* include/bits/basic_string.tcc: Same.

From-SVN: r62865

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_ios.tcc
libstdc++-v3/include/bits/basic_string.tcc
libstdc++-v3/include/bits/c++config
libstdc++-v3/include/bits/fstream.tcc
libstdc++-v3/include/bits/istream.tcc
libstdc++-v3/include/bits/locale_facets.tcc
libstdc++-v3/include/bits/ostream.tcc
libstdc++-v3/include/bits/stl_alloc.h
libstdc++-v3/include/bits/streambuf.tcc
libstdc++-v3/include/std/std_iomanip.h

index 7cb7769..8901a98 100644 (file)
@@ -1,3 +1,16 @@
+2003-02-13  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * include/bits/c++config (_GLIBCPP_EXTERN_TEMPLATE): Define.
+       * include/bits/basic_ios.tcc: Guard use of extern template.
+       * include/std/std_iomanip.h: Same.
+       * include/bits/streambuf.tcc: Same.
+       * include/bits/stl_alloc.h: Same.
+       * include/bits/locale_facets.tcc: Same.
+       * include/bits/ostream.tcc: Same.
+       * include/bits/istream.tcc: Same.
+       * include/bits/fstream.tcc: Same.
+       * include/bits/basic_string.tcc: Same.
+
 2003-02-13  Paolo Carlini  <pcarlini@unitus.it>
 
        * include/bits/ostream.tcc (sentry::sentry): Improve
index 7ee8015..876281a 100644 (file)
@@ -1,6 +1,6 @@
 // basic_ios locale and locale-related member functions -*- C++ -*-
 
-// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -186,11 +186,13 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB:  This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class basic_ios<char>;
 
 #ifdef _GLIBCPP_USE_WCHAR_T
   extern template class basic_ios<wchar_t>;
 #endif
+#endif
 } // namespace std
 
 #endif 
index 3810ae1..f3cb93c 100644 (file)
@@ -1,6 +1,6 @@
 // Components for manipulating sequences of characters -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -933,6 +933,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB: This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class basic_string<char>;
   extern template 
     basic_istream<char>& 
@@ -962,6 +963,7 @@ namespace std
     basic_istream<wchar_t>& 
     getline(basic_istream<wchar_t>&, wstring&);
 #endif
+#endif
 } // namespace std
 
 #endif
index 00983ac..ba8c4f9 100644 (file)
@@ -1,6 +1,7 @@
 // Predefined symbols and macros -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -36,8 +37,7 @@
 // The current version of the C++ library in compressed ISO date format.
 #define __GLIBCPP__ 20030213
 
-// This is necessary until GCC supports separate template
-// compilation.  
+// This is necessary until GCC supports separate template compilation.
 #define _GLIBCPP_NO_TEMPLATE_EXPORT 1
 
 // This is a hack around not having either pre-compiled headers or
 // by the compiler, but instead instantiated into the library binary.
 #define _GLIBCPP_FULLY_COMPLIANT_HEADERS 1
 
+// Allow use of the GNU syntax extension, "extern template." This
+// extension is fully documented in the g++ manual, but in a nutshell,
+// it inhibits all implicit instantiations and is used throughout the
+// library to avoid multiple weak definitions for required types that
+// are already explicitly instantiated in the library binary. This
+// substantially reduces the binary size of resulting executables.
+#ifndef _GLIBCPP_EXTERN_TEMPLATE
+#define _GLIBCPP_EXTERN_TEMPLATE 1
+#endif
+
 // To enable older, ARM-style iostreams and other anachronisms use this.
 //#define _GLIBCPP_DEPRECATED 1
 
index 8f15604..2c591c3 100644 (file)
@@ -505,6 +505,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB:  This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class basic_filebuf<char>;
   extern template class basic_ifstream<char>;
   extern template class basic_ofstream<char>;
@@ -516,6 +517,7 @@ namespace std
   extern template class basic_ofstream<wchar_t>;
   extern template class basic_fstream<wchar_t>;
 #endif
+#endif
 } // namespace std
 
 #endif 
index ea85736..e0ae5ad 100644 (file)
@@ -1,6 +1,6 @@
 // istream classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -1189,6 +1189,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB:  This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class basic_istream<char>;
   extern template istream& ws(istream&);
   extern template istream& operator>>(istream&, char&);
@@ -1204,4 +1205,5 @@ namespace std
   extern template wistream& operator>>(wistream&, wchar_t&);
   extern template wistream& operator>>(wistream&, wchar_t*);
 #endif
+#endif
 } // namespace std
index c8eaa2e..ffb97ea 100644 (file)
@@ -2219,6 +2219,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB: This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class moneypunct<char, false>;
   extern template class moneypunct<char, true>;
   extern template class moneypunct_byname<char, false>;
@@ -2472,6 +2473,7 @@ namespace std
     bool
     has_facet<messages<wchar_t> >(const locale&);
 #endif
+#endif
 } // namespace std
 
 #endif
index 847f00b..a60dd72 100644 (file)
@@ -701,6 +701,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB:  This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class basic_ostream<char>;
   extern template ostream& endl(ostream&);
   extern template ostream& ends(ostream&);
@@ -722,4 +723,5 @@ namespace std
   extern template wostream& operator<<(wostream&, const wchar_t*);
   extern template wostream& operator<<(wostream&, const char*);
 #endif
+#endif
 } // namespace std
index a40f7c1..96b51d1 100644 (file)
@@ -898,9 +898,11 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.
   // NB: This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class allocator<char>;
   extern template class allocator<wchar_t>;
   extern template class __pool_alloc<true,0>;
+#endif
 } // namespace std
 
 #endif
index 44ba1d9..e721f25 100644 (file)
@@ -1,6 +1,6 @@
 // Stream buffer classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -245,6 +245,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB:  This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template class basic_streambuf<char>;
   extern template
     streamsize
@@ -258,6 +259,7 @@ namespace std
     __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,
                      basic_streambuf<wchar_t>*); 
 #endif
+#endif
 } // namespace std
 
 #endif 
index 26756a8..490d5ac 100644 (file)
@@ -1,6 +1,7 @@
 // Standard stream manipulators -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -265,6 +266,7 @@ namespace std
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.  
   // NB:  This syntax is a GNU extension.
+#if _GLIBCPP_EXTERN_TEMPLATE
   extern template ostream& operator<<(ostream&, _Setfill<char>);
   extern template ostream& operator<<(ostream&, _Setiosflags);
   extern template ostream& operator<<(ostream&, _Resetiosflags);
@@ -292,6 +294,7 @@ namespace std
   extern template wistream& operator>>(wistream&, _Setprecision);
   extern template wistream& operator>>(wistream&, _Setw);
 #endif
+#endif
 } // namespace std
 
 #endif