Commit 1bc8b0ad by Benjamin Kosnik Committed by Benjamin Kosnik

c++config (_GLIBCPP_EXTERN_TEMPLATE): Define.


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
parent 659efb32
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> 2003-02-13 Paolo Carlini <pcarlini@unitus.it>
* include/bits/ostream.tcc (sentry::sentry): Improve * include/bits/ostream.tcc (sentry::sentry): Improve
......
// basic_ios locale and locale-related member functions -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -186,11 +186,13 @@ namespace std ...@@ -186,11 +186,13 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class basic_ios<char>; extern template class basic_ios<char>;
#ifdef _GLIBCPP_USE_WCHAR_T #ifdef _GLIBCPP_USE_WCHAR_T
extern template class basic_ios<wchar_t>; extern template class basic_ios<wchar_t>;
#endif #endif
#endif
} // namespace std } // namespace std
#endif #endif
// Components for manipulating sequences of characters -*- C++ -*- // 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. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -933,6 +933,7 @@ namespace std ...@@ -933,6 +933,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class basic_string<char>; extern template class basic_string<char>;
extern template extern template
basic_istream<char>& basic_istream<char>&
...@@ -962,6 +963,7 @@ namespace std ...@@ -962,6 +963,7 @@ namespace std
basic_istream<wchar_t>& basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&); getline(basic_istream<wchar_t>&, wstring&);
#endif #endif
#endif
} // namespace std } // namespace std
#endif #endif
// Predefined symbols and macros -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -36,8 +37,7 @@ ...@@ -36,8 +37,7 @@
// The current version of the C++ library in compressed ISO date format. // The current version of the C++ library in compressed ISO date format.
#define __GLIBCPP__ 20030213 #define __GLIBCPP__ 20030213
// This is necessary until GCC supports separate template // This is necessary until GCC supports separate template compilation.
// compilation.
#define _GLIBCPP_NO_TEMPLATE_EXPORT 1 #define _GLIBCPP_NO_TEMPLATE_EXPORT 1
// This is a hack around not having either pre-compiled headers or // This is a hack around not having either pre-compiled headers or
...@@ -49,6 +49,16 @@ ...@@ -49,6 +49,16 @@
// by the compiler, but instead instantiated into the library binary. // by the compiler, but instead instantiated into the library binary.
#define _GLIBCPP_FULLY_COMPLIANT_HEADERS 1 #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. // To enable older, ARM-style iostreams and other anachronisms use this.
//#define _GLIBCPP_DEPRECATED 1 //#define _GLIBCPP_DEPRECATED 1
......
...@@ -505,6 +505,7 @@ namespace std ...@@ -505,6 +505,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class basic_filebuf<char>; extern template class basic_filebuf<char>;
extern template class basic_ifstream<char>; extern template class basic_ifstream<char>;
extern template class basic_ofstream<char>; extern template class basic_ofstream<char>;
...@@ -516,6 +517,7 @@ namespace std ...@@ -516,6 +517,7 @@ namespace std
extern template class basic_ofstream<wchar_t>; extern template class basic_ofstream<wchar_t>;
extern template class basic_fstream<wchar_t>; extern template class basic_fstream<wchar_t>;
#endif #endif
#endif
} // namespace std } // namespace std
#endif #endif
// istream classes -*- C++ -*- // istream classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -1189,6 +1189,7 @@ namespace std ...@@ -1189,6 +1189,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class basic_istream<char>; extern template class basic_istream<char>;
extern template istream& ws(istream&); extern template istream& ws(istream&);
extern template istream& operator>>(istream&, char&); extern template istream& operator>>(istream&, char&);
...@@ -1204,4 +1205,5 @@ namespace std ...@@ -1204,4 +1205,5 @@ namespace std
extern template wistream& operator>>(wistream&, wchar_t&); extern template wistream& operator>>(wistream&, wchar_t&);
extern template wistream& operator>>(wistream&, wchar_t*); extern template wistream& operator>>(wistream&, wchar_t*);
#endif #endif
#endif
} // namespace std } // namespace std
...@@ -2219,6 +2219,7 @@ namespace std ...@@ -2219,6 +2219,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class moneypunct<char, false>; extern template class moneypunct<char, false>;
extern template class moneypunct<char, true>; extern template class moneypunct<char, true>;
extern template class moneypunct_byname<char, false>; extern template class moneypunct_byname<char, false>;
...@@ -2472,6 +2473,7 @@ namespace std ...@@ -2472,6 +2473,7 @@ namespace std
bool bool
has_facet<messages<wchar_t> >(const locale&); has_facet<messages<wchar_t> >(const locale&);
#endif #endif
#endif
} // namespace std } // namespace std
#endif #endif
...@@ -701,6 +701,7 @@ namespace std ...@@ -701,6 +701,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class basic_ostream<char>; extern template class basic_ostream<char>;
extern template ostream& endl(ostream&); extern template ostream& endl(ostream&);
extern template ostream& ends(ostream&); extern template ostream& ends(ostream&);
...@@ -722,4 +723,5 @@ namespace std ...@@ -722,4 +723,5 @@ namespace std
extern template wostream& operator<<(wostream&, const wchar_t*); extern template wostream& operator<<(wostream&, const wchar_t*);
extern template wostream& operator<<(wostream&, const char*); extern template wostream& operator<<(wostream&, const char*);
#endif #endif
#endif
} // namespace std } // namespace std
...@@ -898,9 +898,11 @@ namespace std ...@@ -898,9 +898,11 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class allocator<char>; extern template class allocator<char>;
extern template class allocator<wchar_t>; extern template class allocator<wchar_t>;
extern template class __pool_alloc<true,0>; extern template class __pool_alloc<true,0>;
#endif
} // namespace std } // namespace std
#endif #endif
// Stream buffer classes -*- C++ -*- // 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. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -245,6 +245,7 @@ namespace std ...@@ -245,6 +245,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template class basic_streambuf<char>; extern template class basic_streambuf<char>;
extern template extern template
streamsize streamsize
...@@ -258,6 +259,7 @@ namespace std ...@@ -258,6 +259,7 @@ namespace std
__copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*, __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,
basic_streambuf<wchar_t>*); basic_streambuf<wchar_t>*);
#endif #endif
#endif
} // namespace std } // namespace std
#endif #endif
// Standard stream manipulators -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -265,6 +266,7 @@ namespace std ...@@ -265,6 +266,7 @@ namespace std
// Inhibit implicit instantiations for required instantiations, // Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere. // which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension. // NB: This syntax is a GNU extension.
#if _GLIBCPP_EXTERN_TEMPLATE
extern template ostream& operator<<(ostream&, _Setfill<char>); extern template ostream& operator<<(ostream&, _Setfill<char>);
extern template ostream& operator<<(ostream&, _Setiosflags); extern template ostream& operator<<(ostream&, _Setiosflags);
extern template ostream& operator<<(ostream&, _Resetiosflags); extern template ostream& operator<<(ostream&, _Resetiosflags);
...@@ -292,6 +294,7 @@ namespace std ...@@ -292,6 +294,7 @@ namespace std
extern template wistream& operator>>(wistream&, _Setprecision); extern template wistream& operator>>(wistream&, _Setprecision);
extern template wistream& operator>>(wistream&, _Setw); extern template wistream& operator>>(wistream&, _Setw);
#endif #endif
#endif
} // namespace std } // namespace std
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment